I've tried numerous variations to get this to work without success. The following code best shows what I'm trying to do, but still is not giving me the correct results.
This is from my form.
<?
while ($r = mysql_fetch_array($result))
{
$array[qid] = $r["qid"];
$array[question]= $r["question"];
$array[aid] = $r["aid"];
$array[answer] = $r["answer"];
?>
<tr><td width="10" valign="top">
<? echo $array[qid]; ?></td>
<td width="300" valign="top">
<? echo $array[question]; ?></td>
<td width="200" valign="top">
<input name="qid[]" type="hidden" value="<? echo $array[qid]; ?>">
<input name="answer[]" type="text" value="" size="30"></td></tr>
<? } ?>
This is from updata.php
foreach($_POST['qid'] as $array[qid]){
$sql = "INSERT INTO answers (qid, answer) VALUES ('$array[qid]','$array[answer]')";
$result2 = mysql_query($sql);
}
The code as it is inserts the new records with the qid value but does not insert the answer value.
How do I get it to insert both values? Any help is appreciated.