have just got a drop down menu working - populated by fields in my mysql dbase and have a resulting results page working as well! (I'm new to php)
But I need to add in a ALL or SELECT option in my drop downs. Currently the choice is
<select>usa</select>
<select>uk</select>
<select>australia</select>
So my results have to contain one of the above options - I don't know how to add in an option for ALL and how to code it...do I get something like this:
<select>ALL</select>
<select>usa</select>
<select>uk</select>
<select>australia</select>
My current script for populating the drop down is as follows:-
<?php
include "config.php";
$db = mysql_connect ($Host, $User, $Password);
mysql_select_db ($DBName) or die ("Cannot connect to database");
/ We have now connected, unless you got an error message /
$SQL = "SELECT id, areas, towns, zip FROM houses";
$myResult = mysql_query($SQL, $db);
while(list($id, $areas, $towns, $zip) = mysql_fetch_array($myResult))
{
$menuOne .= "<option value=\"$areas\">$areas</option>\r";
$menuTwo .= "<option value=\"$towns\">$towns</option>\r";
$menuThree .= "<option value=\"$zip\">$zip</option>\r";
$menuFour .= "<option value=\"$id\">$id</option>\r";
}
mysql_close($db);
echo "<form action=\"srchtest1.php\" method=\"POST\">\r";
echo "<select name=\"fieldOne\">$menuOne</select>\r";
echo "<select name=\"fieldTwo\">$menuTwo</select>\r";
echo "<select name=\"fieldThree\">$menuThree</select>\r";
echo "<input type=\"Submit\" name=\"Submit\" value=\"Submit\">\r";
"<INPUT TYPE=\"HIDDEN\" NAME=\"id\" value=$menuFour>\r";
echo "</form>\r";
?>
Any help would be appreciated.
Thanks