Code: Select all
<tr>
<td>
<form name=trylistsforum action=<?php echo $_SERVER['PHP_SELF']; ?> method=post>
<?php
$host="localhost";
$user="root";
$password="";
$connection = mysql_connect($host,$user,$password)
or die("couldn't connect to server.");
$database = "project";
$db = mysql_select_db($database,$connection)
or die ("couldn't select database.");
$sql = "SELECT DISTINCT continent FROM continent ORDER BY continent";
$result = mysql_query($sql) or die(mysql_error()) ;
echo "<select name=continent onchange='document.trylistsforum.submit();'>";
if (!isset($continent)) { echo "<option value=null selected>Choose a Region</option>";}
while(list($continent) = mysql_fetch_row($result))
{
echo "<option value=$continent";
if ($continent == $continent) { echo " selected"; }
echo ">$continent</option>";
}
echo "</select>";
echo "<select name=country onchange='document.trylistsforum.submit();'>";
if (!isset($country)) { echo "<option value=null selected>Choose Region First</option>"; }
else
{
$query="select DISTINCT country FROM countries where contID='$continent' ORDER BY country";
$result = mysql_db_query($database,$query,$connection);
echo "<option value=null selected>Choose a Model</option>";
while(list($model_id,$name) = mysql_fetch_row($result))
{
echo "<option value=$country";
if ($country == $country) { echo " selected"; }
echo ">$name</option>";
}
}
echo "</select>";
?>
</td>Any help? I'll eventually use a submit button to submit all the values, but that shouldn't be too bad...
Thank you