Jump to content

Recommended Posts

Hello phpfreaks,

 

I'm trying to code a piece of script, whereby when someone selects their location, through a drop down box, it will print out another box with a city, for example

 

<Drop Down Box>

United States

United Kingdom

 

If United States is selected then echo another drop down box.

 

Is someone able to help me?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/113632-drop-down-box/
Share on other sites

i've done it both ways.  Javascript is the toughest especially if you are pulling data from a database, but AJAX does make it 'easier'.  Easiest way is to just add a onchage=this.form.submit() to the first select box, have the form action call the parent page and have code that catches the selected value and populates the second box.

 

Having done it both ways, on a fast connection, I have yet to see a difference in performance between the two methods.

Link to comment
https://forums.phpfreaks.com/topic/113632-drop-down-box/#findComment-583947
Share on other sites

Thanks for the responce,

 

The tutorial seems to be pulling information from a database, rather than just having a php page whereby if you select a county, it will then echo some text, for example,

 

<Drop Down Box>

United States

 

Then when the user selects United States it will produce this:

 

echo ' you selected united states '

 

Is this possible?

 

Thanks again!

Link to comment
https://forums.phpfreaks.com/topic/113632-drop-down-box/#findComment-583954
Share on other sites

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.