frainbreeze
Technical User
hello
Ok this is completely puzzling me, maybe i've been staring at it for too long and need another perspective (cue: tek-tips to the rescuuuuuee)
pretty straight forward survey form submitting to a mysql db with radio buttons/text boxes. has this in the form:
which is fine and dandy, spits out propertly in html. i've got this for the insert statement:
and when it runs it inserts not 1 but 2 rows of blank data. this is what shows up on the screen after submitting:
sentINSERT INTO onlineform (Q1A, Q1B) VALUES ('', '')
and so on and so forth(about 40 some odd blank entries edited out).
what the frick? if my radio buttons are called Q1A/Q1B shouldnt php pick up the $Q1A/$Q1B values and insert em? I dont think its isolated to just radios, as my text fields dont seem to show up in the query either. and why in the world of waldo is it inserting 2 records with only 1 insert statement?!
the <form> action and method(POST) are set, the <form> tag encompasses the submit button (another brilliant oversight i've made before), the submit button has a name="submit" and i have the whole thing in a giant all-encompassing
my brain hurts. its most likely a typo or some other moronic thing on my part, but i cant for the life of me seem to find where it is..
any help is (as usual) much appreciated
frainbreeze
Ok this is completely puzzling me, maybe i've been staring at it for too long and need another perspective (cue: tek-tips to the rescuuuuuee)
pretty straight forward survey form submitting to a mysql db with radio buttons/text boxes. has this in the form:
Code:
<tr>
<td>(i) Network-to-Network learning</td>
<td align="center">
<? $QNUM = "Q1A"?>
<input name="<? echo $QNUM; ?>" type="radio" value="Poor"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Below Average"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Average"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Good"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Excellent"></td>
</tr>
<tr>
<td>(ii) Network development</td>
<td align="center">
<? $QNUM = "Q1B"?>
<input name="<? echo $QNUM; ?>" type="radio" value="Poor"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Below Average"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Average"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Good"></td>
<td align="center"><input name="<? echo $QNUM; ?>" type="radio" value="Excellent"></td>
</tr>
which is fine and dandy, spits out propertly in html. i've got this for the insert statement:
Code:
$sql = "INSERT INTO onlineform (Q1A, Q1B) VALUES ('$Q1A', '$Q1B')";
#sql statement shortened due to about 50 questions, but all are in the same format as above
mysql_query($sql) or die ("Found a mistake:".mysql_error());
$result = mysql_query($sql);
echo "sent";
echo $sql;
and when it runs it inserts not 1 but 2 rows of blank data. this is what shows up on the screen after submitting:
sentINSERT INTO onlineform (Q1A, Q1B) VALUES ('', '')
and so on and so forth(about 40 some odd blank entries edited out).
what the frick? if my radio buttons are called Q1A/Q1B shouldnt php pick up the $Q1A/$Q1B values and insert em? I dont think its isolated to just radios, as my text fields dont seem to show up in the query either. and why in the world of waldo is it inserting 2 records with only 1 insert statement?!
the <form> action and method(POST) are set, the <form> tag encompasses the submit button (another brilliant oversight i've made before), the submit button has a name="submit" and i have the whole thing in a giant all-encompassing
Code:
if (isset ($HTTP_POST_VARS['submit']) )
my brain hurts. its most likely a typo or some other moronic thing on my part, but i cant for the life of me seem to find where it is..
any help is (as usual) much appreciated
frainbreeze