r-it Posted March 14, 2007 Share Posted March 14, 2007 i have this problem, i would like to make a selection on 1 dropdown which will affect the selection of the next dropdown. i have stored my continents and countries in a mysql database. here is the table format for the db: continents- continentID, continent || countries- countryID, continentID, country. I dont know how I can achieve this without the page reloading. please somdebody help. thanx Link to comment https://forums.phpfreaks.com/topic/42661-php-mysql-and-javascript-help/ Share on other sites More sharing options...
tauchai83 Posted March 14, 2007 Share Posted March 14, 2007 retrive the data from DB as usual in the drop down.... the value from "continent" select drop down then pass to next "country" by using input type="hidden" javasrcipt u might use : onChange="submit()" YOU try 1st. Link to comment https://forums.phpfreaks.com/topic/42661-php-mysql-and-javascript-help/#findComment-206972 Share on other sites More sharing options...
r-it Posted March 14, 2007 Author Share Posted March 14, 2007 The only way i know is that the form will be sumbited to the server like this: <td><select name=\"sel_cont\" size=\"1\" onchange=\"document.forms.fmRegister.submit()\"><option value=\"\">Please select one</option>"; $sql = "SELECT * FROM continents ORDER BY continent"; $rez = $conn->query($sql); while($rec = $conn->fetchArray($rez)) { $contid= $rec['continentID']; $cont= $rec['continent']; $show .= "<option value= \"$contid\">$cont</option>"; } $show .= "</select></td> and this will submit to the server and then i will get the selected continent's id and then i can use it in the where clause of the second dropdown, i just don't want it submitting to the server because i have too many things that will be sent to the server when the form is ssubmitted ie. server side validation and such Link to comment https://forums.phpfreaks.com/topic/42661-php-mysql-and-javascript-help/#findComment-206976 Share on other sites More sharing options...
r-it Posted March 14, 2007 Author Share Posted March 14, 2007 ??? someone please help ??? Link to comment https://forums.phpfreaks.com/topic/42661-php-mysql-and-javascript-help/#findComment-206994 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.