I also want a listbox with multiple selection to use along with the above code, but its not working
$cnty is the variable (listbox - multiselection).
Below is my complete ajax function used .
<script language="javascript" type="text/javascript">
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest();
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
//document.myForm.time.value = ajaxRequest.responseText;
document.getElementById("result").innerHTML=ajaxRequest.responseText
}
}
var dav = document.getElementById('dav').value;
var pathogen = document.getElementById('pathogen').value;
var topic1 = document.getElementById('topic1').value;
var ind1 = document.getElementById('ind1').value;
var subindg1 = document.getElementById('subindg1').value;
var cnty = document.getElementById('countryRF').value;
var queryString = "?dav=" + dav + "&pathogen=" + pathogen + "&topic1=" + topic1 + "&ind1=" + encodeURIComponent(ind1) + "&subindg1=" + encodeURIComponent(subindg1) + "&cnty=" + encodeURIComponent(cnty);
ajaxRequest.open("GET", "sortby.php" + queryString, true);
ajaxRequest.send(null);
}
</script>
sortby.php page
<?php
$con = mysql_connect("localhost","root","adminpp");
mysql_select_db("pdata", $con);
$datav=$_GET["dav"];
$pathogen=$_GET["pathogen"];
$topic1=$_GET["topic1"];
$ind1=$_GET['ind1'];
$subindg1=$_GET["subindg1"];
$cnty=$_GET['cnty'];
echo $subindg1;
echo $cnty;
?>