Hi to All
Have a slight problem:
To each text box txt[] is a checkbox chk[] which has the database ID.
When I'm putting some value in text box im checking the checkbox as well. There might be 100 records of which i'm putting some value in the text box as well checking the checkbox pertaining to the text box.
<input name="txt[]" type="text" size="4" maxlength="4">
<input name="chk[]" type="checkbox" value="<? echo $row['ID'] ?>">
Now when i press the Update button
I do the following loop to see which check boxes were selected and update the required field with text box value
for ($i=0; $i < count($chk); $i++)
{
$uquery = "UPDATE tbl_age SET fld_age = txt[$i] where fld_id = $chk[$i]";
$uresult = mysql_query($uquery) or die("Query failed");
}
The query works but since im not able to link the text box with the check box, the array of text box is 100 whereas if i've checked only 2 checkboxes so the update is completely wrong.
If i've check the 3rd & 4th check box it takes the text box value starting from 1, 2, and so on.
So how do i only get the 3rd and the 4th text box values only for the checked box 3rd, and 4th.
I hope this is clear, can somebody please help me out, really stuck at this one.
Thanks a lot