2016-04-15 96 views
1

我有一個下面的下拉列表中的php塊下循環。另一個php塊是彈出窗口使用facebox。現在如何通過點擊下拉內容將值傳遞給第二個php塊。傳遞值到相同的PHP文件

<?php 


     $msql="select notification_id,applicant_id,notification_dis from app_notification where applicant_id=$app_id order by notification_id desc " ; 
     $result_msql=$bd->query($msql); 
     while($messagecount=$result_msql->fetch_assoc()) 

     { 
     $not_id= $messagecount['notification_id']; 
     $comment=$messagecount['notification_dis']; 


     ?> 




      <div class="comment_ui" > 



     <a href="#info" class='view_comments' rel='facebox' id="<?php echo $not_id; ?>"></br> <?php echo "check1---$not_id".$comment."";?> 
       </a>     

      </div> 

////另一個是

 <?php 



     echo $_POST['not_id']; 
     $mysql_hostname = "localhost"; 
     $mysql_user = "root"; 
     $mysql_password = ""; 
    $mysql_database = "test"; 
    $prefix = ""; 

     $bd = new mysqli($mysql_hostname, $mysql_user,   $mysql_password,$mysql_database) or die("Opps some thing went wrong"); 


      echo "check2---$not_id"; 

      $msql_show="select header_type,notification_main,notification_dis from app_notification where notification_id=$not_id"; 
      $show_msql=$bd->query($msql_show); 

      while($message_show=$show_msql->fetch_assoc()) 
      { 
       $header=$message_show['header_type']; 
       $main=$message_show['notification_main']; 


      $msql_multi="SELECT file_name FROM biz_logo WHERE w_id=(SELECT w_id FROM post_job 
      WHERE job_id=(SELECT job_id FROM job_notice WHERE 
      notice_id=(SELECT notice_id FROM app_notification where notification_id=$not_id)))"; 
      } 
      $msql_multi=$bd->query($msql_multi); 
      while($message_multi=$msql_multi->fetch_assoc()) 
      { 

       $file_name=$message_multi['file_name']; 



      } 



      print "<center><h1>".$header."$not_id</h1></center>"; 
    print"<span style='margin-right:50em'><table> 
       <p><t>".$file_name."</t></p><tr><td>".$main."</td> 
    </tr> <tr><td></td></tr></table><span> ";    
      ?> 





     <?php }?> 
+0

我想在點擊時使用not_id – iftekhar143

+0

您必須通過ajax或yo將值傳遞給第二塊(將其更改爲函數)你將不得不點擊提交頁面。 – VipindasKS

+0

「$( 「view_comments 」)點擊(函數() { \t 變種ID = $(本).attr(「 ID」); $就({ 類型: 「POST」, URL: 「notifications.php」, 數據: 「not_id =」 + ID, 緩存:假, 成功:功能(數據){ 警報( 「工作」);} }); 返回假; });' – iftekhar143

回答

0

php中手動您可以使用會話,或者如果您需要

$_SESSION["favcolor"] = "green"; 
$_SESSION["favanimal"] = "cat"; 


<?php 
// Echo session variables that were set on previous page 
echo "Favorite color is " . $_SESSION["favcolor"] . ".<br>"; 
echo "Favorite animal is " . $_SESSION["favanimal"] . "."; 
?> 

,或者如果你需要使用HTML,您可以使用輸入框和後獲取方法

+0

當我點擊下拉內容時,應該在第二個塊上發送該內容的ID 我可以從數據庫中獲得的ID ..這裏顯示notification_id – iftekhar143

+0

據我所知,第二塊是用於使用facebox在彈出窗口中顯示內容。如果是這種情況,您可以創建popup.php並將變量作爲查詢字符串傳遞。像popup.php? not_id = 1(無論)。請參閱facebox選項來執行此操作。顯然,你的第二塊代碼應該在popup.php中。 – VipindasKS

+0

所以代碼將是notification VipindasKS