faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 18 people (61%) answered Yes
Recently 7 of 10 people (70%) answered Yes


How can I pass a variable with a button(in objective question--A,B,C,D)?

Feb 27th, 2008 00:00
dman, Chris Hayes, nickhee wong, http://www.ttnr.org

Make a normal webform (method=post), be sure to name the form elements
and read out the results in the next page from the $_POST array! 
If the form elements are radio buttons:
<form method=post action=nextpage.php>
<input type=radio name=answer value=A>
<input type=radio name=answer value=B>
<input type=radio name=answer value=C>
<input type=radio name=answer value=D>
echo 'The given answer was answer '.$_POST['answer'];