On 7/22/06, Chris Grigor <chris@xxxxxxxxxxxxxx> wrote:
Afternoon all I need some help here with a problem on dynamic radio buttons. I have a script that calls a database for a list of questions. The questions are returned and each question needs to have 5 radio buttons assigned to it. The radio buttons are a score of 1 - 5 (1 being bad, 5 being good) For example 1 . How would you rate your vacation? 1 2 3 4 5 <--- those are the radio buttons. 2. How would you rate your dining at the resort? 1 2 3 4 5 Ok so I have all the questions being returned, I was thinking when creating the radio buttons as follows <input name="<?php echo $row_get_question_list['id']?>" type="radio" value="1" /> <input name="<?php echo $row_get_question_list['id']?>" type="radio" value="2" /> <input name="<?php echo $row_get_question_list['id']?>" type="radio" value="3" /> <input name="<?php echo $row_get_question_list['id']?>" type="radio" value="4" /> <input name="<?php echo $row_get_question_list['id']?>" type="radio" value="5" /> The input name for each radio group is the questions id from the database. If there are 50 questions you would have 50 radio button answers submitted. How are you going to identify the radio buttons being submitted as they are dynamic? and also I would need to be stored in the session data as they might want to go back / forward a page. So basically I need to go through each $_GET item, identify it as a radio submission and put it into an array. Has anyone done anything similar before / or can point me in the right direction?? Kind regards Chris
You won't get all the radio buttons sumbitted. You will have only the checked buttons. So for every question's ID you will have the radio button that was checked. Just do some testing. Try echoing the $_POST array after you submit the form. var_dump($_POST); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php