I created a table that contains Student id etc. Then i fetch all the database data into the table, while making the hyperlink of the Student ID's row. So the problem is i wanted to show the clicked Student ID specifically at the new page with its own details. I found a few ways to do it but it is in mysql, i do it using sqlsrv. This is my code.
$sql = 'select * from StudentAttn order by Dates';
$params = array();
$options = array("Scrollable" => SQLSRV_CURSOR_KEYSET);
$stmt = sqlsrv_query( $conn, $sql , $params, $options );
This is my fetch
if ($num_rows > 0){
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo "<tbody style='border: 1px solid black; border-collapse: collapse; background-color: white'><tr>"
. "<td align='center' for='Student_ID'>" . "<a href='http://localhost:8080/myschool/Studentdetail.php>" .$row['Student_ID']."</a>"."</td>"
This is the next page
$sql1 = 'select * from StudentAttn where Student_ID = "'.$_SESSION['Student_ID'].'" ';
Sorry for these mess up. I am new here.
DO this: Pass your data in query string then fetch it using $_GET in second page:
while ( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo "<tbody style='border: 1px solid black; border-collapse: collapse; background-color: white'><tr>"
. "<td align='center' for='Student_ID'>" . "<a href='http://localhost:8080/myschool/Studentdetail.php?Student_ID=".$row['Student_ID'].">" .$row['Student_ID']."</a>"."</td>";
the next page
$sql1 = 'select * from StudentAttn where Student_ID = "'.$_GET['Student_ID'].'" ';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.