Hi,
I have a following piece of code below. I need to generate a <select> menu according to the value given by the form f.
Somehow the script generating select menu named "hotels" cannot read the value posted by form f. I cannot figure out what the problem is here.
Pertti
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<table width="75%" border="1">
<form name=f action="<?php echo $PHP_SELF; ?>" >
<tr><td><select name="country" onChange="document.f.submit()">
<option value="" <?php if ($country == ""){ echo "SELECTED"; } ?> >
<option value="Eesti" <?php if ($country == "Eesti"){ echo "SELECTED"; }?> >Eesti
<option value="Lati" <?php if ($country == "Lati"){ echo "SELECTED"; } ?> >Läti
<option value="Rootsi" <?php if ($country == "Rootsi") { echo "SELECTED"; }?> >Rootsi
</select></td></tr>
</form>
<form name=m method="post" action="<?php echo $PHP_SELF; ?>" >
<tr>
<td>Suusakuurort</td>
<td><select name=hotels>
<?php
$db=mysql_connect("localhost", "addirekt", "abk34as");
mysql_select_db("addirekt", $db);
$result = mysql_query("SELECT * FROM towns WHERE country = '$country'", $db);
$nr = mysql_num_rows($result);
$i = 1;
do {
$select = mysql_query("SELECT town FROM towns WHERE id = '$i'", $db);
$select2 = mysql_fetch_row($select);
echo "<option value= $i > $select2[1] </option>";
$i = $i + 1;
} while ($i < ($nr+1))
?>
</select></td>
</tr>
</body>
</html>