查看所有学生到特定学生

时间:2015-11-30 15:10:52

标签: php mysql

抱歉给我带来不便,我决定再次编辑主要问题,我有一个关于我的php-mysql的问题,我有一个页面,其中包含所有学生的表格,我想查看他们个人查看完整的详细信息,可以如果我点击IndividualStudentView.php仍然想要查看学生但特别是学生的详细信息,你会帮我做什么?

          <thead>
                         <tr> <th hidden="">Id</th>
                               <th>ID Number</th>
                               <th>Firstname</th>
                               <th>Middlename</th>
                               <th>Lastname</th>
                               <th>Sex</th>

                       </tr>
                  </thead>


<?php
    $con=mysqli_connect("localhost","root","","enrollmentsystem");
        // Check connection
        if (mysqli_connect_errno())
          {
          echo "Failed to connect to MySQL: " . mysqli_connect_error();
          }

        $result = mysqli_query($con,"SELECT * FROM studentpersonalinformation ORDER By Id DESC");

        while($row = mysqli_fetch_array($result))
                    {

                        ?>




<tbody>
      <tr>
          <td hidden=""><?php echo $row['Id']?></td>
               <td><?php echo $row['IDNumber']?></td>
               <td><?php echo $row['Firstname']?></td>
               <td><?php echo $row['Middlename']?></td>
               <td><?php echo $row['Lastname']?></td>
               <td><?php echo $row['Sex']?></td>
                         <td>
                             <a href="IndividualViewStudent.php" class="btn btn-info" role="button">Option</a>

                         </td>
     </tr>
  </tbody>




          <?php
          }

        mysqli_close($con);


                     ?>     
        </table>`

2 个答案:

答案 0 :(得分:0)

您没有将studentid传递给IndividualViewStudent.php。

<a href="IndividualViewStudent.php?Id=<?php echo $row['Id']?>" class="btn btn-info" role="button">Option</a>

答案 1 :(得分:0)

正如你所说,你有一张供所有学生使用的桌子,当你点击某个学生的按钮/桌子时,它应该只显示有关该学生的信息。

我认为你可以用双向方式做到这一点。

  1. 在同一页上
  2. 当您点击特定学生的表格时,它应覆盖整个页面的上下文,并将该学生的信息显示为custom confirm box。例如,在Facebook上,当您想要查看查看您个人资料的所有人时。单击“查看更多”,弹出窗口将显示所有人员的姓名。

    您可以在此处详细了解confirm box

    链接:https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm

    1. 在另一页上。
    2. 正如您所做的那样,通过单击按钮/表来查看IndividualViewStudent.php以获取各个详细信息。为此,您必须通过任何方法GET或POST将有关学生的一些信息(如学生ID)传递给其他页面。 然后我们应该使用这个id来使mysqli Query找到特定的学生。 然后获取数据并以格式化样式在页面上显示它。

      获取方法:http://php.net/manual/en/reserved.variables.get.php

      POST方法:http://php.net/manual/en/reserved.variables.post.php

相关问题