I guess that would work, but you would want to use php to mark the array numbers in the form then. When a form is posted in this manner, a checkbox will post a value if it checked or not. A text box won't. So matching them up would become tricky if you don't provide the keys yourself. Though, a better solution here would probably be radio buttons since you probably only want one answer to be returned as the correct one, and in a radio series, only one can be chosen.
I'm not exactly sure what you're doing allowing them to provide multiple answers and mark one as correct, but here's a crack at the code. Maybe you can expand on this to accomplish what you need to.
# Here's an example of the form using radio buttons.
# Table is there just for layout purposes
<table>
<tr>
<th>Answer</th>
<th>Correct Answer?</th>
</tr>
<?php
for($i=1;$i<=3;$i++) {
?>
<tr>
<td><input type="text" name="inputanswer[<?php echo $i; ?>]" /></td>
<td><input type="radio" name="correct" value="<?php echo $i; ?>" /></td>
</tr>
<?php
}
?>
</table>
<?php
# Now on the handler, you'll only have one value for the correct answer.
# Just match it with the predefined keys
#
# This assumes you've done your checking already to make sure
# the values are set and so forth.
foreach($_POST['inputanswer'] as $key => $answer) {
if($key == $_POST['correct']) {
# if this is true, this is the one they marked as correct
}
$query2 = "insert into answer_entry (answer) values('".$answer."')";
$result2 = mysql_query($query2);
}
?>