i have some problems with my code.. i want to create a search function and display the info in the page listing., i have no idea about it,, i just learn about ajax for 2 days.. and the code i've made is not working.. The idea is first, to display all the information from the db, then, if user want, they can search or view the information given by entering required info or select the search button.. #HTML ---> #AJAX ---> #PHP ----> #HTMLthis is the HTML page:\[code\]<form name="ajaxform"><table><tr><td>Enter Ic:</td><td><input type="text" name="ic" value="" onchange="ic=this.value; showHint(ic, nama, status);"></td></tr><tr><td>Enter name:</td><td><input type="text" name="nama" value="" onchange="nama=this.value; showHint(ic, nama, status);"></td></tr><tr><td>Select status:</td><td><select name="status" onchange="status=this.value; showHint(ic, nama, status);"><option value="">All</option><option value="http://stackoverflow.com/questions/13739938/Single">Single</option><option value="http://stackoverflow.com/questions/13739938/Married">Married</option><option value="http://stackoverflow.com/questions/13739938/Divorced">Divorced</option></select></td><tr><td><input type="submit" name="search" value="http://stackoverflow.com/questions/13739938/Search" onclick="showHint(ic, nama, status)"></td><td><input type="reset" name="reset" value="http://stackoverflow.com/questions/13739938/Reset"></td></tr></table></form>\[/code\]And this is the AJAX script that the function call:\[code\]var ic = ''; var nama = ''; var status = '';function showHint(ic, nama, status) { var xmlhttp; //if(ic.length == 0 & nama.length == 0 & status.length == 0) { // document.getElementById("txtHint").innerHTML = ""; //} if(window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function () { if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("txtHint").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET", "getSearch.php?ic=" + ic + "&nama=" + nama + "&status=" + status, true); xmlhttp.send();}\[/code\]and this is the PHP file..\[code\]<?phpinclude('connection.php');$ic = $_GET['ic'];$nama = $_GET['nama'];$status = $_GET['status'];$sql = mysql_query("SELECT COUNT (ic) AS total FROM register");echo "<table border='1'><tr><th>No</th><th>Name</th><th>IC</th><th>Status</th><th>Username</th><th>Password</th></tr>";if (strlen($ic)!=0 && strlen($nama)!=0 && strlen($status)!=0){if ($sql>0){ $query = mysql_query("SELECT * FROM register WHERE ic LIKE '%$ic%' OR nama LIKE '%$nama%' OR status LIKE '%$status%'") or die(mysql_error()); //echo "hehehe"; $num=0; while ($num < $sql) { $h=1; while ($row = mysql_fetch_array($query)) { if ($h<=$sql) { echo "<tr>"; echo "<td>" . $h. "</td>"; echo "<td>" . $row['nama'] . "</td>"; echo "<td>" . $row['ic'] . "</td>"; echo "<td>" . $row['status'] . "</td>"; echo "<td>" . $row['username'] . "</td>"; echo "<td>" . $row['password'] . "</td>"; echo "</tr>"; $h++; } //echo "hehehe"; } $num++; } echo "</table>";}else{ echo "No Records";}}?>\[/code\]do you have any idea why the code is not working.. ?