English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How to make an oprion box, which its contents are changing according to what is choosen by first option box?

for example the first option box choosing the name of country and accordingly the second one shows the names of states and cities(taken from database-mysql)...

I'm doing my project with PHP (and JavaScript)...

2006-07-13 02:01:25 · 5 answers · asked by QuestionAnswer 2 in Computers & Internet Programming & Design

Country and City just was an example....

Actually I'm designing a web directory, and when someone is adding a website to this directory, these option boxes show the branches and subbranches where the website must to be placed...

2006-07-13 02:10:13 · update #1

5 answers

Take a look at this forms generation and validation class: http://www.phpclasses.org/formsgeneration .

It comes with a linked select plug-in that lets you link an unlimited sequence of select inputs, so the ones of one are switched when the selected value of the previous changes. Take a look at this example page: http://www.phpclasses.org/browse/file/9879.html

The plug-in comes with variants that take the options of the select input groups from a database rather than from static arrays. There are variants to take the options from a MySQL database or other databases using the database independent APIs Metabase or PEAR::MDB2 .

2006-07-13 06:32:25 · answer #1 · answered by Manuel Lemos 3 · 0 0

You can use the AJAX technology to achieve this without have the browser to submit.

Using AJAX, you can send the country id to another php, fetch the database and group the state's list and send it back to main php file. (this happens in background since we use AJAX). when you get the info, using javascript you can update the new values to state list box.

2006-07-13 02:06:50 · answer #2 · answered by gansatanswers 3 · 0 0

You will need to use javascript to do this. You can try this script

Country State Drop Down
http://javascript.internet.com/forms/country-state-drop-down.html

or some others that are more generic

Auto Drop Down
http://javascript.internet.com/forms/auto-drop-down.html

Category Form Script
http://javascript.internet.com/forms/category-form-script.html

Country Chooser
http://javascript.internet.com/forms/country.html

More form element effects
http://javascript.internet.com/forms/index.html

Or if you want to use some Ajax (fancier javascript and your php), some of these tutorials might help

http://javascript.internet.com/ajaxTutorials/

2006-07-13 02:19:28 · answer #3 · answered by Anonymous · 0 0

Javascript is the answer to that genuinely. because you probably did not provide the visuals of what you're doing, it really is hard for me to furnish a script for you, that's going to take me about 2-3 minutes to furnish you with a demo if i'll work out the layout of the stuff.

2016-11-01 23:45:21 · answer #4 · answered by Anonymous · 0 0

its in here

http://javascript.internet.com/forms/

2006-07-13 02:11:17 · answer #5 · answered by bow4bass 4 · 0 0

fedest.com, questions and answers