Jump to content

Multi Radio Button (problem with return values)


houssam_ballout
 Share

Recommended Posts

hello all,I am building a questionnaire, so each question has different options (checkbox, radio button and comments which is text box).I'd multi radio buttons that are created dynamically and text boxes and radio buttons (which are working great except the radio buttons), because I should gave them same name.I think of way, by giving the radio buttons the name which is $idQuestion , in order for the user to be able to select one radio button for each question, but how can use that array when the form is sent back?Thanks in advance

Link to comment
Share on other sites

hello all,I am building a questionnaire, so each question has different options (checkbox, radio button and comments which is text box).I'd multi radio buttons that are created dynamically and text boxes and radio buttons (which are working great except the radio buttons), because I should gave them same name.I think of way, by giving the radio buttons the name which is $idQuestion , in order for the user to be able to select one radio button for each question, but how can use that array when the form is sent back?Thanks in advance
I've at last got round to dropping WAMP onto a virtual PC so I can start playing with this stuff. So I've used your question as the basis of my very first php practice! My own answer, based on what I would do in other languages, is below.
<form action="action.php" method="post"> <p>Field 1: <input type="text" name="Field1" /></p> <p>Field 2: <input type="text" name="Field2" /></p> <p>Field 3: <input type="text" name="Field3" /></p> <p><input type="submit" /></p></form>

for ($i = 1; $i < 4; $i++) {	echo $i . ':' . $_POST['Field'.$i] . ' ';}

Hopefully this will help you a bit, and perhaps we'll both learn more from further responses from those who've used php a bit longer!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...