PHP: Form / Field Change upon Radio Selection?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tdpreston86
Forum Newbie
Posts: 1
Joined: Wed Jul 02, 2008 4:34 pm

PHP: Form / Field Change upon Radio Selection?

Post by tdpreston86 »

This is what i am trying to do

I have 3 radio buttons and when 1 of the 3 is selected i want a drop down selection based on the value of the selected radio button. I think that makes sense?

Say name for radio buttons is "radio" and value is 1, 2 and 3.

When 1 is selected drop down menu with options for 1.
When 2 is selected drop down menu with options for 2.

I dont use php that much, would this be something for javascript??

Thanks.
kilermedia
Forum Newbie
Posts: 7
Joined: Wed Jul 02, 2008 11:00 pm
Location: California, USA

Re: PHP: Form / Field Change upon Radio Selection?

Post by kilermedia »

Definitely something I'd do with JavaScript (more like AJAX).
Set a JavaScript function to "un-hide" a div (or span) containing the options or even have the function directly print the options to the div within the "onclick" event of the radios in question by way of XHR. If you don't know what XHR is you need to study that crazy buzz word every one's been using lately...AJAX!
tdpreston86 wrote:This is what i am trying to do

I have 3 radio buttons and when 1 of the 3 is selected i want a drop down selection based on the value of the selected radio button. I think that makes sense?

Say name for radio buttons is "radio" and value is 1, 2 and 3.

When 1 is selected drop down menu with options for 1.
When 2 is selected drop down menu with options for 2.

I dont use php that much, would this be something for javascript??

Thanks.
Post Reply