I have a form which contains a repeating number of records and each record has a text box.
The code for the text box is:
<input name="item[<?php echo $row_rsName['fldNameID']; ?>][Name]" type="text" ?>
When the form is submitted I do some error checking of the entered data:
foreach($_POST['item'] as $item_id => $data)
{
IF ($data['Name'] == 'TEST') { //error message code here}
}
If it fails the user is re-presented with the form to correct their error. On the other text boxes on the page I have made the text box's default value the value that was previously submitted so the user doesn't have to fill out the whole form again due to one error.
I just can't figure out how to set the value of the text boxes in this repeating row using the previously submitted data. The data isn't stored in a database at this point (as it failed the validation) so I need to be able to pull out the $data['Name'] value that corresponds to each row.
If there were just few static rows I'd just have Text1, Text2, Text3 as my textboxes but as each text box is tied to a specific row that repears however many times it needs to I have to use the array.
Any ideas?