I have this form:
[url]http://www.mikeglaz.com/606club/join.php#personality
When the user submits the form and there are some errors on the form (i.e. the form doesn’t submit but prints errors to the user, like blank fields) I want the form to remember all the fields. I’ve been using the $_POST variable to remember the state of the filled in fields. But I don’t know how to do an array of checkboxes. Right now I have 22 checkboxes and and I’m checking each $
here’s my code:
[CODE]
<a name=”personality”><p class=”minusMargin”><b>Describe your personality:</b></a>
<table cellspacing=”5″ border=”0″ class=”personality”>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”considerate” <?php if($_POST[‘personality’][0] == ‘considerate’) {echo ‘checked=”checked”‘;}?> /> Considerate</td>
<td><input type=”checkbox” name=”personality[]” value=”confident” <?php if($_POST[‘personality’][1] == ‘confident’) {echo ‘checked=”checked”‘;}?>/> Confident</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”open-minded” <?php if($_POST[‘personality’][2] == ‘open-minded’) {echo ‘checked=”checked”‘;}?>/> Open-Minded</td>
<td><input type=”checkbox” name=”personality[]” value=”sociable” <?php if($_POST[‘personality’][3] == ‘sociable’) {echo ‘checked=”checked”‘;}?>/> Sociable</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”fun” <?php if($_POST[‘personality’][4] == ‘fun’) {echo ‘checked=”checked”‘;}?>/> FUN</td>
<td><input type=”checkbox” name=”personality[]” value=”affectionate” <?php if($_POST[‘personality’][5] == ‘affectionate’) {echo ‘checked=”checked”‘;}?>/> Affectionate</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”kind” <?php if($_POST[‘personality’][6] == ‘kind’) {echo ‘checked=”checked”‘;}?>/> Kind</td>
<td><input type=”checkbox” name=”personality[]” value=”ambitious” <?php if($_POST[‘personality’][7] == ‘ambitious’) {echo ‘checked=”checked”‘;}?>/> Ambitious</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”quiet” <?php if($_POST[‘personality’][8] == ‘quiet’) {echo ‘checked=”checked”‘;}?>/> Quiet</td>
<td><input type=”checkbox” name=”personality[]” value=”adventurous” <?php if($_POST[‘personality’][9] == ‘adventurous’) {echo ‘checked=”checked”‘;}?>/> Adventurous</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”reliable” <?php if($_POST[‘personality’][10] == ‘reliable’) {echo ‘checked=”checked”‘;}?>/> Reliable</td>
<td><input type=”checkbox” name=”personality[]” value=”shy” <?php if($_POST[‘personality’][11] == ‘shy’) {echo ‘checked=”checked”‘;}?>/> Shy</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”witty” <?php if($_POST[‘personality’][12] == ‘witty’) {echo ‘checked=”checked”‘;}?>/> Witty</td>
<td><input type=”checkbox” name=”personality[]” value=”crazy” <?php if($_POST[‘personality’][13] == ‘crazy’) {echo ‘checked=”checked”‘;}?>/> Crazy</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”silly” <?php if($_POST[‘personality’][14] == ‘silly’) {echo ‘checked=”checked”‘;}?>/> Silly</td>
<td><input type=”checkbox” name=”personality[]” value=”humorous” <?php if($_POST[‘personality’][15] == ‘humorous’) {echo ‘checked=”checked”‘;}?>/> Humorous</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”prankster” <?php if($_POST[‘personality’][16] == ‘prankster’) {echo ‘checked=”checked”‘;}?>/> Prankster</td>
<td><input type=”checkbox” name=”personality[]” value=”well-read” <?php if($_POST[‘personality’][17] == ‘well-read’) {echo ‘checked=”checked”‘;}?>/> Well-Read</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”well-traveled” <?php if($_POST[‘personality’][18] == ‘well-traveled’) {echo ‘checked=”checked”‘;}?>/> Well-Traveled</td>
<td><input type=”checkbox” name=”personality[]” value=”not_traveled_enough” <?php if($_POST[‘personality’][19] == ‘not_traveled_enough’) {echo ‘checked=”checked”‘;}?>/> Not Traveled Enough</td>
</tr>
<tr>
<td><input type=”checkbox” name=”personality[]” value=”articulate” <?php if($_POST[‘personality’][20] == ‘articulate’) {echo ‘checked=”checked”‘;}?>/> Articulate</td>
<td><input type=”checkbox” name=”personality[]” value=”bussiness-like” <?php if($_POST[‘personality’][21] == ‘bussiness-like’) {echo ‘checked=”checked”‘;}?>/> Business-Like</td>
</tr>
<td><input type=”checkbox” name=”personality[]” value=”foot_loose” <?php if($_POST[‘personality’][22] == ‘foot_loose’) {echo ‘checked=”checked”‘;}?>/> Foot Loose and Fancy Free</td>
<td> </td>
</tr>
</table>
</p>
thanx,
mike