...

View Full Version : Asking about using Combobox



cakapcakap
01-25-2012, 07:19 PM
Dear PHP master,
I am newbie in PHP.
I have question so far about creating combobox.

The case :
I need to use a combobox in login page.
Such us:


Login as : [ Administrator, Operators, Users ];
Password : [password];

value of Login As (Administrator, Operators, Users) put on a combobox.

When we choose Login as Administrator, nothing will be changed.
But when we choose Login as Operator, there will be changed in the bottom of Login As form. The location of Operator will be showed.

Be like:

Login as : Operator ;
Location : [Nevada, Illinois, New York] ;
Password : [password];

Value of Location also put on a combobox.

Does anybody know how to create code for this case?
Hopefully the case was explained well.
Please help me. Thanks.

felgall
01-25-2012, 08:19 PM
1. Combo boxes are a new addition in HTML 5. To get them to work web browsers that don't yet support it you need JavaScript to link the list part of the combo box to the input box part.

Or did you mean a select list where the user must enter one of the entries in the list and doesn't have the additional option of entering their own.

2. Any changes you want to make based on a selection in one box (whether it is a combobox or a select liist) means you need to reload the page from the server with those changes applied. You would test the value of the first box when displaying the page in order to display the content appropriate to that selection. You might also use JavaScript to make the changes in place but you can't rely on that and so should have the PHP reload of the page set up to allow the update to happen when JavaScript isn't available.

cakapcakap
01-25-2012, 08:40 PM
1. Combo boxes are a new addition in HTML 5. To get them to work web browsers that don't yet support it you need JavaScript to link the list part of the combo box to the input box part.

Or did you mean a select list where the user must enter one of the entries in the list and doesn't have the additional option of entering their own.

I mean when a list is selected, the sub of the list will be showed in bottom of the list.
just like example: when Operator is selected, the sub values of the Operator, the list of Location of Operator will be showed up.

If Administrator is selected, nothing will be changed because it dosn't have any sub values.




2. Any changes you want to make based on a selection in one box (whether it is a combobox or a select liist) means you need to reload the page from the server with those changes applied. You would test the value of the first box when displaying the page in order to display the content appropriate to that selection. You might also use JavaScript to make the changes in place but you can't rely on that and so should have the PHP reload of the page set up to allow the update to happen when JavaScript isn't available.

Any code suggestion for me ? :D

felgall
01-25-2012, 10:06 PM
For some ideas on how to update it in the browser itself using JavaScript see http://www.felgall.com/jstip22.htm

For the server side version when reloading the page you'd simply use the value that the first select already contains to determine what to display under it.

cakapcakap
01-26-2012, 04:58 AM
For some ideas on how to update it in the browser itself using JavaScript see http://www.felgall.com/jstip22.htm

For the server side version when reloading the page you'd simply use the value that the first select already contains to determine what to display under it.

thanks for your suggestion. :thumbsup:
let me check and try it first. :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum