<?php
$sname=$_GET['sname'];
$con=mysql_connect("localhost","root","");
$d=mysql_select_db("bca_programs",$con);
$result=mysql_query("select *from student where sname='$sname'");
while($row=mysql_fetch_array($result))
{
echo $row['sno']."--".$row['sname']."--".$row['per']."
";
}
?>
1.html-
<html>
<script >
function dis()
{var ob=false;
ob=new XMLHttpRequest();
var name= document.getElementById("sname").value;
ob.open("GET","slip_12.php?sname="+name);
ob.send();
ob.onreadystatechange=function()
{
if(ob.readyState==4 && ob.status==200)
{
document.getElementById("snamed").innerHTML=ob.responseText;
}
}
}
</script>
<body>
Enter student name Name<input type="text" name=sname id=sname>
<input type="submit" value=submit>
<span id="snamed"></span>
</body>
</html>