2015-09-08 33 views
-1

我想知道是否有人可以幫忙?我試圖在用戶點擊一個鏈接時將2個從數據庫中提取的變量發送到另一個頁面。目前我只能發送一個。我知道我在下面做的是錯誤的.....基本上我想發送uninum和groupid到另一個頁面。當用戶點擊鏈接時如何將2個變量發送到不同的頁面

for ($i = 0; $i < $count; $i++){ 
        $q = "SELECT participants.sname, participants.uninum, groups.groupid FROM participants INNER JOIN groups ON participants.uninum = 
        groups.uninum WHERE groups.groupid ='".$groups[$i]."'";   
        $result = mysqli_query ($dbcon, $q); // Run the query. 
        if ($result) { // If it ran, display the records. 
         // Table header. 
         echo '<table> 
         <tr><td><b>Edit</b></td> 
         <td><b>Surnname</b></td> 
         <td><b>University ID</b></td> 
         <td><b>Group</b></td> 
         </tr>'; 
         // Fetch and display the records: 
         while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 
          echo '<tr> 
          <td><a href="edit_group_member.php?uninum=' . $row['uninum'] . ' ?groupid=' . $row['groupid'] . ' ">Edit</a></td> 
          <td>' . $row['sname'] . '</td> 
          <td>' . $row['uninum'] . '</td> 
          <td>' . $row['groupid'] . '</td> 

          </tr>'; 
         } 
         echo '</table>'; // Close the table. 
         mysqli_free_result ($result); // Free up the resources. 

         echo "<br><br>"; 
         } else { // If it did not run OK. 
         // Public message: 
         echo '<p class="error">The current users could not be retrieved. We apologize for any inconvenience.</p>'; 
         // Debugging message: 
         echo '<p>' . mysqli_error($dbcon) . '<br><br>Query: ' . $q . '</p>'; 

        } 
       } 
+0

使用及到位秒? –

+0

它需要'&groupid ='而不是'?groupid =' – Ankh

回答

1

你已經在你的代碼中使用?代替&

<td><a href="edit_group_member.php?uninum=' . $row['uninum'] . ' ?groupid=' . $row['groupid'] . ' ">Edit</a></td> 

應該是:

<td><a href="edit_group_member.php?uninum=' . $row['uninum'] . ' &groupid=' . $row['groupid'] . ' ">Edit</a></td> 
+0

非常感謝Sunil,Svengali和Callan。我會將它標記爲在一瞬間回答。 – Ray

0

你可以試試這個:

<a href="edit_group_member.php?uninum=' . $row['uninum'] . ' &groupid=' . $row['groupid'] . '&other_param=value">Edit</a> 
相關問題