2017-04-06 60 views
0

有一個列出SQL的表,並且我在每一行都添加了一個按鈕,我希望它將其鏈接到另一個頁面。bootstrap按鈕並使用行數據將其鏈接到另一個頁面

問題是我想要那個按鈕來打開正確的數據行。

<div class="container"> 
<div class="jumpbotron"> 
<table class="table table-striped"> 
     <thead> 
      <tr class="success"> 
       <td>Date</td> 
       <td>Subject</td> 
       <td>Details</td> 
       <td>Status</td> 
       <td>ticket id</td> 
       <td>Actions</td> 



      </tr> 

     </thead> 
<?php  

     while($row=mysqli_fetch_array($result))//while look to fetch the    result and store in a array $row. 
     { 

      $date=$row[2]; 
      $subject=$row[3]; 
      $detail=$row[4]; 
      $status=$row[5]; 
      $tickid=$row[0]; 

     ?> 
     <form method="post"> 
     <tbody method="post"> 

      <td class="col-md-1"><?php print_r($date); ?></td> 
      <td class="col-md-1"><?php print_r($subject); ?></td> 
      <td class="col-sm-2"><?php print_r($detail); ?> </td> 
      <td class="col-md-1"><?php print_r($status); ?></td> 
      <td class="col-md-1"><?php echo $tickid ; ?></td> 
      <td class="col-md-1"><a href="detail.php" name="submit"  id="submit"class="btn btn-sm btn-success">Details</td> 

     </tbody> 
     </form> 

     <?php } ?> 
    </table> 
</div> 
</div> 

回答

0

你可以使用$ _GET [「身份證」],此外,用戶可以複製的URI和分享您的當前行的詳細信息,請detail.php的$ tickid。

<a href="detail.php?id=<?php echo $tickid; ?>" name="submit" id="submit" class="btn btn-sm btn-success"> 
+0

嗨,我試着用GET和回聲它。但我無法得到這個tickid。 – Sypnoticjr

+0

如果您使用的是按下ctrl + shift + i,並確保您的錨標記的href是detail.php?id = something。 – Hienz

相關問題