sayedsohail Posted May 26, 2007 Share Posted May 26, 2007 Hi everyone, sorry for asking this question again, but this is something i am stuck, at the moment i am able to communicate with php ajax and display data using get method with some errors 'Parse error: syntax error, unexpected T_STRING in dropdownlist.php on line 11' If someone just direct me to create a dropdown drill where on key press it populate a dropdown list to select the city and on select just close the dropdown list of cities. Since I got addresses stored in database I thought to populate these addresses right below the address text input, than user just selects from the drop down list and the text field get updated with the city user selected. I am stuck, any advise would be greatly appreciated. thanks for reading. Sorry here is my complete code: <html> <title>Drop Down Test</title> <head> ... all other head stuff here ... <script language="javascript"> <!-- function createSelect(allist){ var xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); xmlHttpReq.open('get', 'dropdownlist.php?alist='+allist, false); xmlHttpReq.send(); var response = xmlHttpReq.responseText; document.getElementById('displayaddress').innerHTML = response; } //--> </script> </head> <body> Type Address: <Input name="address" class="textbox" onkeyup="createSelect(this.value)"> <div id="displayaddress"></div> </body> </html> <?PHP include_once('../config.php'); include_once('../opendb.php'); $sa=$_GET['allist']; $Qrydata="SELECT id, name FROM clientsview WHERE name LIKE '$sa%'"; $result=mysql_query($Qrydata) or die('Error, query failed'); $outdata= "<select name=\"ddaddress\">"; while( $dlist = mysql_fetch_array($result) ) $outdata.="<option value='".$dlist['id']."'>" .$dlist['name']."</option>"; $optStr.="</select>"; echo $outdata; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53085-php-ajax-dropdown-error-in-populating-cities/ Share on other sites More sharing options...
MadTechie Posted May 26, 2007 Share Posted May 26, 2007 <?PHP should be <?php as for line 11, woudn't thats be in the "... all other head stuff here ..." Quote Link to comment https://forums.phpfreaks.com/topic/53085-php-ajax-dropdown-error-in-populating-cities/#findComment-262258 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.