Hey there,
I am looking to have 2 drop down lists, 1 for provinces and 1 for cities.
i saw some examples in java script but since i dont know how to use java and i do know and LOVE php i wondering if anyone can help me with this

Thank you,

<select name="city">

<option value="london">london</option>
<option value="paris">paris</option>
<option value="new york">new york</option>


this will give you a dropdown box with citys, just add a new option line for each new entry, the whole dropdown box is called "city", this is what you would use to identify or call the option thats selected. ..this dropdown box would all have to sit inside a form which will be submitted to the database.

Not sure i explained myself correctly,i am looking to have 2 drop down lists, 1 with provinces/states and the other with the corresponding cities in that province. example:
Toronto will show up when i choose ontario. or Los Angeles will be an option if the state is California. I cant have Toronto in California.

thank you, so complicated i will have to think of something easier:)

Member Avatar for diafol

Sorry, was late in with this. A php solution will require Ajax OR a page refresh on 1st dropdown select.

JS only solution is easy if you don't want to store the dropdown data in a DB.

The Ajax solution is EASY with jquery. Still interested?

thanks for the will to help i actually got around this by prompting the user before for a province and city.
took the long way around :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.