Solution:
Html file:
<html>
<head>
<title>Slip13.html</title>
<script>
function search()
{
srch=document.getElementById('txtsrch').value;
ob=new XMLHttpRequest();
ob.onreadystatechange=function()
{
if(ob.readyState==4 && ob.status==200)
{
document.getElementById('o').innerHTML=ob.responseText;
}
}
ob.open("GET","slip13.php?s="+srch);
ob.send();
}
</script>
</head>
<body>
<table align=center border=0 style="margin-top:20%">
<tr><td width="90px;"><input type=text id=txtsrch placeholder="enter search string" onkeyup="search()"> </td>
<tr><td><span id=o></span></td></tr>
</table>
</body>
</html>
Php File:
<?php
$search=$_GET['s'];
$con=mysql_connect("localhost","root","");
$d=mysql_select_db("bca_programs",$con);
$r=mysql_query("select * from hin where wo LIKE '$search%'");
while($row=mysql_fetch_array($r))
{
echo "<h1>".$row[0]."</h1>" ;
}
?>
0 Comments