Re: php hide menu
| From: | Joshua Kehn | Date: | Tue, 07 Jun 2011 04:43:26 +0000 |
| Subject: | Re: php hide menu | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313421@lists.php.net to get a copy of this message | ||
Sounds like a good job for client side JavaScript.
Regards,
-Josh
____________________________________
Joshua Kehn | Josh.kehn@gmail.com
http://joshuakehn.com
On Jun 7, 2011, at 12:40 AM, Chris Stinemetz wrote:
> 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.";
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>