Forum Moderators: coopster

Message Too Old, No Replies

form with 2 radio buttons

how to know which button is selected?

         

redweb

5:43 pm on Mar 11, 2006 (gmt 0)



Hi,

I have a form with 2 radio buttons on it and based on the value of the button selected, I would like my form to go to different pages. for example if I clicked on the first option, the submit would go to
page_1.php, if I clicked on the second button, the submit would go to page_2.php .

Here is my code :


<?php
print ("<form method=post>
<input type=radio name=gender value=m/>male<br>
<input type=radio name=gender value=f />female<br>
<hr>
<input type=submit >
</form>");

?>


Does anyone know how to do this?

Thanks

phpagemod

6:31 pm on Mar 11, 2006 (gmt 0)



$output='<form method="get" action="index.php">
<div>
<input type=radio name=page value="page1" />male<br/>
<input type="radio" name="page" value="page2" />female<br>
<hr/>
<input type="submit" name="">
</div>
</form>';

// do not pass http_vars to include without testing
include($_GET['page'].".php");