Each day I make more progress learning PHP...
Today I created a form that has repeated fields and rather than build form fields manually for each I used a little while loop. The loop works great..the form looks good...but I am not sure how I can add a field that is generally null but when a form field fails validation, it will, be presented back to the user next or by the invalid form field.
in my manually build form I would simply do the following:
<tr> <td>City</td> <td colspan="2" align="left"><input name="lcity"
type="text" id="lcity" accesskey="d" tabindex="4"
value="<?php echo $_POST['lcity']; ?>"> *<?php echo $fe4;?></td> </tr>
where the $fe4 would be set to whatever message I wanted and then displayed on the re-display of the form.
BUT...now that I am building form fileds based on an interatin, example:
$i = 1;
while ( $i<20 )
{
?>
<tr align="center">
<td align="center"><input name="<?php echo divName.$i; ?>" type="text" id="<?php echo divName.$i; ?>" size="35"></td>
<td align="center"><select name="<?php echo divGender.$i; ?>" id="<?php echo divGender.$i; ?>">
<option value="X" selected>-:Gender:-</option>
<option value="B">Boys</option>
<option value="G">Girls</option>
<option value="C">Coed</option>
</select></td>
<td align="center"><select name="<?php echo divAge.$i; ?>" id="<?php echo divAge.$i; ?>">
<option value="00" selected>-:Age Group:-</option>
<option value="08">U8</option>
<option value="09">U9</option>
<option value="10">U10</option>
<option value="11">U11</option>
<option value="12">U12</option>
<option value="13">U13</option>
<option value="14">U14</option>
<option value="15">U15</option>
<option value="16">U16</option>
<option value="17">U17</option>
<option value="18">U18</option>
<option value="19">U19</option>
<option value="99">N/A</option>
</select></td>
</tr>
<tr align="center">
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php
$i++;
}
How can I associate something similar to $fe4, but starting with $fex where x = the loop inteartion..like $i. but I don't want the $fex to be set to null unless I assign a message value to it.