Hi,
In PHP I need some help on radio button.

I am trying to put two radio buttons in a php file.By selecting first radio button the page should display radio button selected and one text field.By selecting the second radio button it should display the second radio button selected plus a combo box.

Kindly guide me.

I will just get your started. Post back the improvements that you make to my code. There has to be at least something of value you add when you post back, OKAY.

Filename: index.php

<form name = 'test' action = 'script_01.php' method='post'>
<input type='radio' name='optionSelected' value='1'>Option 1
<br>
<input type='radio' name='optionSelected' value='2' checked> Option 2
<br>
<input type='Submit' value='submit'>
</form>

filename: script_01.php

<?php
@extract($_POST);
print $optionSelected;
?>

Now add the logic which will display the text box and drop down boxed based on the return value of $optionSelected being 1 and 2 respectively. You could use if ... elseif ...else

Hi,
Thanks for your reply...
This solution looks like if you click on radio button and then submit it then on other window it shows the value.

But my query was if I select a radio button from a page it should show the values with radio button on same.No button click event should happen.Just a selection of radio button should show the result.

Hi,
Thanks for your reply...
This solution looks like if you click on radio button and then submit it then on other window it shows the value.

But my query was if I select a radio button from a page it should show the values with radio button on same.No button click event should happen.Just a selection of radio button should show the result.

Hi ..
I dont have that much time to do this...but
Try see this link...
http://www.a1javascripts.com/form_navigation/radiobuttonclick/radiobuttonclick.html


Get code from this..
I think it will help u...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.