jquery - Live search in table php -
i create simple search engine want whenever search name display in table is. thing other data hide , don't know how do. html code.
<form name="view" method="post" div class="frm1"> <table align="center" class="record_table" > <tr bgcolor="#006600" height="50" style="color:#fff;"> <th> </th> <th>name</th> <th>email</th> <th>packages</th> <th>contactno</th> <th>gender</th> <th>file</th> <th>address</th> <th>action</th> </tr> search: <input type="text" size="20" name="search" onkeyup="srch();"> <div id="d1"</> <script> function srch() { xmlhttp=new xmlhttprequest(); xmlhttp.open("get","dbsearchfile.php?view="+document.view.search.value,false); xmlhttp.send(null); document.getelementbyid("d1").innerhtml=xmlhttp.responsetext; } </script> and php code.
<?php $view=$_get['view']; mysql_connect("localhost","root",""); mysql_select_db("pm"); $res=mysql_query("select * tblreservation name ('$view%');"); echo "<table>"; while($row=mysql_fetch_array($res)) { echo "<tr>"; echo "<td>"; echo "<div class=frm1>"; echo "<a href='#'>". $row['name'] . "</a>"; echo "</td>"; echo "</tr>"; } echo "</table>"; ?>
see:
<div id="d1"</> correct:
<div id="d1"></div> and
$res=mysql_query("select * tblreservation name ('$view%');"); suggestion:
$res=mysql_query(" select * tblreservation name '".$view."%'; ");
Comments
Post a Comment