here is my code and iam not able to do search in that.only the first search box list the data and when i given second search option both results wont come any idea
//this is my html code
<script>
function showUser(str) {
if (str == "") {
document.getElementById("txtHint").innerHTML = "";
return;
} else {
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","getuser.php?q="+str+"&&k="+str,true);
xmlhttp.send();
}
}
</script>
<form>
<select name="users" onchange="showUser(this.value)">
<option value="">Select Class:</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="1">5</option>
<option value="2">6</option>
<option value="3">7</option>
<option value="4">8</option>
<option value="1">9</option>
<option value="2">10</option>
<option value="3">+1</option>
<option value="4">+2</option>
</select>
<select name="users" onchange="showUser(this.value)">
<option value="">Division</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
<option value="E">E</option>
<option value="F">F</option>
<option value="G">G</option>
<option value="H">H</option>
<option value="I">I</option>
<option value="J">J</option>
<option value="K">K</option>
<option value="L">L</option>
<option value="M">M</option>
<option value="N">N</option>
</select>
</form>
<br>
<div id="txtHint"><b>Person info will be listed here...</b></div>
<!-- Default box -->
// this is my getuser.php
<!DOCTYPE html> <html> <head> <style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 5px;
}
th {text-align: left;}
</style> </head> <body> <th> <a href="editschoolentry.php?classs=<?php echo $row['classs'];?>">Edit</a> </th> <th> <a href="deleteschoolentry.php">Delete</a> </th> <th> <a href="logout.php">logout</a> </th> <?php
if(isset($_POST['update']))
{
include "edit.php";
}
$q = intval($_GET['q']);
$k= intval($_GET['k']);
$con = mysqli_connect('localhost','root','');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"shamsu");
$sql="SELECT * FROM schoolentry WHERE classs =".$q." and division = ".$k."";
$result = mysqli_query($con,$sql);
echo "<table> <tr> <th>Image</th> <th>Student Name</th> <th>Admission No</th> <th>Parent Name</th> <th>Classs</th> <th>Division</th> <th>Address1</th> <th>Address2</th> <th>Address3</th> <th>Address4</th> <th>Pincode</th> <th>Phone No</th> <th>DOB</th> <th>Adhar No</th> <th>Blood Group</th> <th>Mobile No</th> <th>Edit</th> <th>Delete</th> </tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<form action=edit.php method=POST>";
echo "<td>" . $row['image'] . "</td>";
echo "<td>" . $row['student_name'] . "</td>";
echo "<td>" . $row['admission_no'] . "</td>";
echo "<td>" . $row['parent_name'] . "</td>";
echo "<td>" . $row['classs'] . "</td>";
echo "<td>" . $row['division'] . "</td>";
echo "<td>" . $row['p_address'] . "</td>";
echo "<td>" . $row['p_address1'] . "</td>";
echo "<td>" . $row['p_address2'] . "</td>";
echo "<td>" . $row['p_address3'] . "</td>";
echo "<td>" . $row['p_address4'] . "</td>";
echo "<td>" . $row['p_address5'] . "</td>";
echo "<td>" . $row['dob'] . "</td>";
echo "<td>" . $row['adhar_no'] . "</td>";
echo "<td>" . $row['blood_group'] . "</td>";
echo "<td>" . $row['mobile_no'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?> </body> </html>