DigiMartKe Posted November 6, 2015 Share Posted November 6, 2015 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 https://forums.phpfreaks.com/topic/299301-on-select-value-not-being-passed-to-php/ Share on other sites More sharing options...
Muddy_Funster Posted November 24, 2015 Share Posted November 24, 2015 are you assigning a value to $q? when passing values through form input (either by ajax or normal form submission) the value is normally passed to either the $_GET or $_POST superglobals. To get the value out of that you would access it like any other associative array: $q = $_GET['q']; Link to comment https://forums.phpfreaks.com/topic/299301-on-select-value-not-being-passed-to-php/#findComment-1527029 Share on other sites More sharing options...
Ch0cu3r Posted November 24, 2015 Share Posted November 24, 2015 Why start a new topic? You already have a topic with the same question here. Please do not post duplicate topics, carry on where you left off. Locked. Link to comment https://forums.phpfreaks.com/topic/299301-on-select-value-not-being-passed-to-php/#findComment-1527040 Share on other sites More sharing options...
Recommended Posts