Re: php hide menu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sounds like a good job for client side JavaScript.

Regards,

-Josh
____________________________________
Joshua Kehn | Josh.kehn@xxxxxxxxx
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
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux