Jump to content

php mysql and javascript help


r-it

Recommended Posts

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

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

Archived

This topic is now archived and is 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.