I have textbox that are query from database. I show this textbox from while loop.
$ans_no = 0;
while($ed_ans_row = mysql_fetch_array($ed_ans_query)) {
$edit_answer = $ed_ans_row['name'];
$edit_id = $ed_ans_row['id'];
echo "<input type=\"text\" name=\"ans[]\" class=\"ans\" value=\"$edit_answer\" /><br/>";
echo "<input type=\"hidden\" name=\"edit_id[]\" class=\"ans\" value=\"$edit_id\" />";
}
Now, I want to save this pair of answer and id into database like this:
UPDATE table SET answer='ans[0]' WHERE id='edit_id[0]';
But I don't know how many textbox are query from database. And how to update this answer and id together correctly.
I don't have a lot of experience in php. Thanks for every reply.
$ans_no??name=\"ans-".$edit_id."\". it will be easier later on when trying to save.