Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-25-2012, 06:19 PM   PM User | #1
cakapcakap
New to the CF scene

 
Join Date: Jan 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
cakapcakap is an unknown quantity at this point
Question Asking about using Combobox

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.
cakapcakap is offline   Reply With Quote
Old 01-25-2012, 07:19 PM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,468
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 01-25-2012 at 07:30 PM..
felgall is offline   Reply With Quote
Old 01-25-2012, 07:40 PM   PM User | #3
cakapcakap
New to the CF scene

 
Join Date: Jan 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
cakapcakap is an unknown quantity at this point
Quote:
Originally Posted by felgall View Post
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.


Quote:
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 ?
cakapcakap is offline   Reply With Quote
Old 01-25-2012, 09:06 PM   PM User | #4
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,468
Thanks: 0
Thanked 499 Times in 491 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 01-26-2012, 03:58 AM   PM User | #5
cakapcakap
New to the CF scene

 
Join Date: Jan 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
cakapcakap is an unknown quantity at this point
Quote:
Originally Posted by felgall View Post
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.
let me check and try it first.
cakapcakap is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:07 PM.


Advertisement
Log in to turn off these ads.