Hi to all,

I am beginner in the field of php & I have a problem as,
I want to show a form , after selection of one of the two radio buttons choices & then click on submit button.

Can i use "onclick()" for this ?
if Yes, please suggest me How ?
if Not , then what should be the right code for this ?

any suggessions will be appreciated.

Thanks & Regards.

Member Avatar for diafol

onclick is for javascript (don't bother with this).
You should look for radiobutton values in the $_POST variable that appears in the next page after the form is submitted.

<input type="radio" name="test" value = "first" />My first one
<input type="radio" name="test" value = "second" />My second

The page you specified in the action attribute of your form tag:

<form action="formhandler.php" method="post"> ....

should then have the $_POST['test'] variable.
If you have echo $_POST['test'] somewhere in this page, you'll get 'first' or 'second' appear on the screen, depending which radio button you selected.

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.