Jump to content

On select value not being passed to php


DigiMartKe

Recommended Posts

I have the following code for my dropbox;

 

<select name="Symptom" id="Symptomid"  onchange="LSC(this.value)"> 

 

Its options are;

 

  <option value="<?php echo $row_RsSymptom['name']?>"><?php echo $row_RsSymptom['name']?></option>

 

i have the script ;

 

<script>
function LSC(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","LoadSymptomDetails.php?q="+str,true);
        xmlhttp.send();
    }
}
</script>
 
 
The LoadSymptomDetails.php
 
has the following lines;
 
$sql1 = mysql_query("SELECT name,description , comments
FROM symptoms WHERE symptoms.name ='".$q."'") or die(mysql_error());
 
 
The q is not being picked. If i remove the where statement it runs and displays the table.
 
 
Kindly assist.
 
Azhar
 

 

 

Link to comment
Share on other sites

  • 3 weeks later...
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.