mishuk Posted March 14, 2007 Share Posted March 14, 2007 I am not sure how to ask this question efficiently but please bare with me 1. I have an input form that has a number of drop down boxes containing workshops. These workshops also have ratings next to them that the user selects through radio buttons. (input for code below) 2. I have a table set up with a stud id, workshop id and rating. which i would like to populate. My problem is that i am unsure how to populate the values into the table. - it is not known how many workshops the student attended, i.e one student may only enter one out of the four available dropdown boxes where another may enter values for all four. - What would be the best way to enter the values without entering records. Input form example <tr> <td align="right"> <? $res=mysql_query("select workshop_id, workshop from tbl_workshop"); if(mysql_num_rows($res)==0) { echo "No Data"; } else { echo '<select name="q3a">'; echo '<option value = "-1">Select:</option>'; while($row=mysql_fetch_assoc($res)) { echo '<option value="' . $row['workshop_id'] . '">' . $row['workshop'] . '</option>'; } echo '</select>'; }; ?> </td> <td align="center"> <Input type = "Radio" Name = "q3a1" value = "6"></td> <td align="center"><Input type = "Radio" Name = "q3a1" value = "7"></td> <td align="center"><Input type = "Radio" Name = "q3a1" value = "8"></td> </td> </tr> repeated four times "3b, 3c, ..." --------------------------------------------------------- process form code so far $stud = ($_POST['stud_id']); $workshop = ($_POST['q3a']); $rating = ($_POST['q3a1']); // insert data into table $addy9feedback = "INSERT INTO tbl_y10 (stud_id, workshop, rating) VALUES ('$stud', '$workshop', '$rating')"; $result = mysql_query($addy9feedback) or die(mysql_error()); how would i then add in q3b, q3c, ...?? Thanks for any suggestions Link to comment https://forums.phpfreaks.com/topic/42771-input-from-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.