I have a table of members from a database. I want to filter the results on the same page without reloading using the following form
The ajax code isHTML Code:<select name="club" onchange="filter(this.value)"> <option value="">Select A Club</option> <option value="1">1</option> <option value="2">2</option> </select>
the php on the page doesnt catch the postHTML Code:function filter(status){ var url = "index.php"; var xmlhttp; if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); }else{// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("POST", url, true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send("status="+status); }
Any help pleasePHP Code:$sql = "SELECT * FROM members ";
if($_POST){
$club = $_POST['status'];
$sql .= "WHERE club = $club ";
}
$sql .= "ORDER BY surName DESC";



Reply With Quote
Bookmarks