houssam_ballout Posted February 16, 2008 Share Posted February 16, 2008 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 More sharing options...
Reg Edit Posted February 17, 2008 Share Posted February 17, 2008 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 advanceI'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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.