Wednesday, 13 December 2017

Search Without Ajax

Hi All,
Find the code below.

<html>
<body>
<?php
include('connect.php');
?>
<form method=post>
<pre>

Name    <input type=text name=name>

<input type=submit value='Search' >
</form>
</pre>
<table border=1 align=center>
<tr><th>Id</th><th>Name</th><th>Marks</th><th>Rank</th></tr>"
<?php
if(isset($_POST['name']))
{

$name=$_POST['name'];
$sql="select * from tbl_student where st_name like '%$name%'";

$data=mysql_query($sql,$con) ;
while($row=mysql_fetch_row($data))
{
echo "<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]

</td><td><a href=delstudent.php?id=$row[0]&name=$row[1]&marks=$row[2]

>Delete<a></td></tr>";

}

}

?>
</table>   
</body>
</html>

2 comments: