php hide menu
| From: | Chris Stinemetz | Date: | Tue, 07 Jun 2011 04:40:41 +0000 |
| Subject: | php hide menu | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-313420@lists.php.net to get a copy of this message | ||
I have three drop down menus in my form. How do I make it so the
second and third menus are only visible once the prior menu was
selected?
Below is the first two drop down menus.
Thanks in advance.
// Generating first menu using array.
$markets = array('MCI' => 'Kansas City',
'STL' => 'ST. Louis',
'ICT' => 'Wichita',
'OMA' => 'Omaha',
'LIN' => 'Lincoln');
echo "<select name='term'><option value=''>Choose
Market</option>\n";
foreach ($markets as $key => $market) {
echo "<option value='$key'>$market</option>\n";
}
echo "</select>";
// This will evaluate to TRUE so the text will be printed.
if (isset($markets)) {
echo "This var is set so I will print.";
}
// Then, later, validating the menu
if (! array_key_exists($_POST['Market'], $choices)) {
echo "You must select a market.";
}
$query="SELECT cell_sect FROM sector_list order by cell_sect";
$result = mysql_query ($query);
echo "<select name='cat'><option value=''>Choose Cell
Sector</option>";
// printing the list box select command
while($cellSect=mysql_fetch_array($result)){//Array or records stored
in $cellSect
echo "<option value=$cellSect[cell_sect]>$cellSect[cell_sect]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
// This will evaluate to TRUE so the text will be printed.
if (isset($cellSect)) {
echo "This var is set so I will print.";
}