The dropdown list is on the client (browser). Javascript runs on the
client. PHP runs on the server. 

You have 2 options 

- one is to do as Richard says and use javascript to change the contents
of one select box when an option is selected in another. 
- the other is to refresh the page when the option is selected and write
different data into the second select box based on the option selected.
This is a question of using echo and iterating through the data you wish
to output.


-----Original Message-----
From: Danny Brow [mailto:[EMAIL PROTECTED] 
Sent: 01 June 2005 07:08
To: PHP-Users
Subject: Re: [PHP] dynamic drop down


On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote:
> On Tue, May 31, 2005 8:48 pm, Danny Brow said:
> > Could someone point me to an example with code for dynamic drop 
> > downs in PHP? I would like to be able to have drop downs like 
> > "Select Country" and another drop down show the states/provinces 
> > based on the selected country.
> 
> Well, the "dynamic" part of it isn't gonna be in PHP at all ; It's 
> gonna be JavaScript.

I thought I'd have to use JS, but was hoping someone knew a way to do it
with PHP.


> You can Google for "JavaScript dynamic menus" to find what you want.  
> Then you just need to use PHP to spew out the JavaScript you want to 
> spew out, but that's no different than spewing out the HTML you want 
> to spew out, really.

Tons on google, thanks,

Dan.

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND REGISTERED FOR 
ISO 9001:2000 CERTIFICATION

**********************************************************************

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**********************************************************************
**********************************************************************


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

Reply via email to