Hi,
What my form does now is takes a vaule in a text box, a number that the user enters. Then they hit an update button. From this the below scrip is run and replicated depending on the number the user entered in the text box.
Code:
for ($i=1; $i<=$_POST['number']; $i++) {
$var .= "<tr>
<td>{$i}<input type='text' name=\"".$id."[person]\" size='25' value=\"".$person."\"></td>
<td align='center'><input type='radio' name=\"".$id."[ind1]\" value='1'></td>
<td align='center'><input type='radio' name=\"".$id."[ind1]\" value='2'></td>
<td align='center'><input type='radio' name=\"".$id."[ind1]\" value='3'></td>
<input type='hidden' name=\"".$id."[checked]\" value='1'>
</tr>";
$id ++;
}
The goal I want is for example say the user misses another field on the form that is required, and hits the submit button. How do I make it so the values the user puts in the above text boxs and radio buttons stay and do not get cleared. At the moment all I can do is keep the amout of times the boxes are duplicated but not their values.
So if a user insert 3 in the number field and hits update, then hits the final submit i get 3 text fields and 3 radio buttons but not their values. I can however keep the value for the number field as i do an if isset test then echo the value, however im not sure how to do that for this. For example if i wasnt using a dynamic array to generate the fields i would do as follows
Code:
<input type="text" name="station_name" size="20" maxlength="20" value="<?php if(isset($_POST['station_name'])) echo $_POST['station_name']; ?>" />
If this is unclear, please let me know and i will try to explain it better
Thanks