i want to link each student name from student list with there profile page i have tried but its not working can any one solve this.Thanks in advance.
This is student list code and i am sending data to delete page for deleting any student from list and also i want link there names with there profiles if i want to check there profile.
<form action="php\student_list_delete.php" method="POST">
<table id="table_style" border="1px" align="center">
<tr>
<td colspan="6" style="border-right: none; border-bottom: none;">
<h2>Student Information List</h2><b>Dempartment of Computer Sceince</b>
</td>
<td style="border-left: none; border-bottom: none;"><img src="images/logo.png" width="80px" height="80px"></td>
</tr>
<!-- ============= Student Information List header Start here ============= -->
<?php
std_list_header();
?>
<!-- ================= Student Information List header End here ================ -->
<tr class="table_header" >
<th width="50px">S/N</th>
<th>Name</th>
<th>F/Name</th>
<th>Session</th>
<th>Semister</th>
<th>Phone</th>
<th>Delete</th>
</tr>
<!-- ================= Student Information List body Start here ================ -->
<?php
$query="SELECT id,name,fname,phone FROM student";
$resultset=$connection->query($query);
$count=0;
while($r=$resultset->fetch_assoc()){
$count++;
echo "<tr><td>".$count."</td><td><a href='".$r["id"]."'>".$r["name"]."</a></td><td>".$r["fname"]."</td><td></td><td><td>".$r["phone"]."</td><td><input type='checkbox' name='chb".$count."' value='".$r["id"]."'></td></tr>
";
}
?>
<!-- ================= Student Information List body End here ================ -->
<tr>
<td colspan="7" align="right"><input type="submit" value="Delete"></td>
</tr>
</table >
</form>
This is the student profile page code.
function std_table_profile(){
$result=$connection->query("SELECT name,fname,gender,email,phone,address,image FROM student WHERE id='".$r["id"]."'");
$rs=$result->fetch_assoc();
".$res["name"]." to ".$r["name"]."
lets say your link to the profile page looks like this
/profile.php?id=32
in your profile page(profile.php) you retrieve id using $_GET
<?php
function std_table_profile($student_id){
// your query...WHERE id='".$student_id."'"...
return $result;
}
$id = $_GET['id'];
$student_data = std_table_profile($id);
print_r($student_data);
If you are using router you need to preg_match your uri