Hello:
I was wondering if someone can help me out.
I’ve created a form which contains three sets of checkboxes. The first checkbox is behavior[]. The second is current[]. The third is prior[].
The behavior[] is the root element. The values that go into behavior[] are: Abuse, Agression, Eating Disorder, etc.
The current[] is a child element to behavior[]. The values for current[] are Physical, Mental, Verbal, etc.
The prior[] is a child element to behavior[] as well. The values are the same as in current[].
Therefore the result after submitting my form should show something like this:
Behavior:Current
Abuse?hysical
Abuse:Mental
Agression:Younger Child
Agression:Adult
Does anyone know how to code the form so I can have the relationship between behavior[] and current[] as well as behavior[] and prior[]?
This is how my form looks so far. I only included one behavior and its current and prior options. There are over 50 behaviors.
[CODE]
<table class=”apptable”>
<tr><th scope=”col”>Behavior</th><th scope=”col”>Current</th><th scope=”col”>Past</th></tr>
<tr><td class=”i”>
<input type=”checkbox” name=”behavior1[]” value=”Abuse”<?php echo ( isset ( $_SESSION[‘behavior1’] ) && in_array(‘Abuse’, $_SESSION[‘behavior1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Abuse </td>
<td class=”h”>
<input type=checkbox name=current1[] value=”Physical”<?php echo ( isset ( $_SESSION[‘current1’] ) && in_array(‘Physical’, $_SESSION[‘current1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Physical
<input type=checkbox name=current1[] value=”Emotional”<?php echo ( isset ( $_SESSION[‘current1’] ) && in_array(‘Emotional’, $_SESSION[‘current1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Emotional<br>
<input type=checkbox name=current1[] value=”Sexual”<?php echo ( isset ( $_SESSION[‘current’] ) && in_array(‘Sexual’, $_SESSION[‘current1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Sexual
<input type=checkbox name=current1[] value=”Recent”<?php echo ( isset ( $_SESSION[‘current1’] ) && in_array(‘Recent’, $_SESSION[‘current1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Recent<br></td>
<td class=”h”>
<input type=checkbox name=prior1[] value=”Physical”<?php echo ( isset ( $_SESSION[‘prior1’] ) && in_array(‘Physical’, $_SESSION[‘prior1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Physical
<input type=checkbox name=prior1[] value=”Emotional”<?php echo ( isset ( $_SESSION[‘prior1’] ) && in_array(‘Emotional’, $_SESSION[‘prior1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Emotional<br>
<input type=checkbox name=prior1[] value=”Sexual”<?php echo ( isset ( $_SESSION[‘prior1’] ) && in_array(‘Sexual’, $_SESSION[‘prior1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Sexual
<input type=checkbox name=prior1[] value=”Recent”<?php echo ( isset ( $_SESSION[‘prior1’] ) && in_array(‘Recent’, $_SESSION[‘prior1’]) ? ‘ checked=”checked”‘ : ” ); ?> />Recent<br></td>
</tr> </table>
<input type=”submit” name=”btnSubmit” id=”btnSubmit” value=”Update Record” class=”btn” >
<input type=”hidden” name=”submitted” value=”TRUE” />
</form>
Thanks for the help.