Jump to content

Recommended Posts

Hi All
I would like to write a little application where people enter their details in a catagory and a sub-category.
They then enter their state/province as well as their city.
What I want to write is to have two drop-down boxes, one with the state/province and another one with the city.
It must only show the state/province for the selected category and sub-category, and it in turn must only how the cities for the state/province that has been selected.

Can anyone give me some advice

Thanks

Lional
Link to comment
https://forums.phpfreaks.com/topic/15155-drop-down-based-on-criteria/
Share on other sites

you can use javascript to auto submit the form once the user selected a category and subcategory. when you have those information, then you will be able to query for the state/province info, and so on.
[code]<select name="category" onChange="document.form1.submit()">[/code]

just keep in mind that if you use this function you don't want to name one of your buttons "submit". this would confuse the browser.
Is there another solution without using javascript.
Let me explain the structure how it runs si far.
1) the user selects the category and subcategory and submits it to a page. If there are more than 6 listings on the new page the user can then streamline their search by entering the state/province. I would however only like to show the cities that are applicable to a state/proince but this must work everytime so I do not think that javascript is an option
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.