I hve a form that people can fill out and they press the submit button which takes them to the same page, but puts their selection in a select box for later use. What I need to do is if there is something already in the select box and they choose something else, I want it to add to what is already in the select box, so I tried to create and array called $check and pass it along and have the select box go through it and get its selections. My code is below. Can anyone please help? Thanks!
<form name="add_drug_interact" method="post" action="<? $PHP_SELF?>">
<tr>
<td nowrap>
<?
for ($i=0; $i< $D->numrows; $i++) {
$lbl_name=trim($D->results["LBL_NAME"][$i]);
$edtn_cde=$D->results["PAT_EDTN_CDE"][$i];
$gcn_seq_nbr=$D->results["GCN_SEQ_NBR"][$i];
if ($i==100) {
break;
}?>
<input name="add[]" type="checkbox" value="<?= $gcn_seq_nbr . "," . $lbl_name?>">
<input type="hidden" name="gcn_seq_nbr" value="<?= $gcn_seq_nbr?>">
<input type="hidden" name="search_text" value="<?= $search_text?>">
<?echo $lbl_name;?>
<br>
<? } ?>
</td>
<td width="64" rowspan="100" align="left" valign="top"> <input type="submit" name="Add" value="Add -->"></td>
<?
$check = $add;
array_push($check,$add);
//print_r ($check);
?>
<input type="hidden" name="checked" value="<?= $check?>">
</form>
<td rowspan="100" valign="top" align="left" width=""> </td>
<td rowspan="100" valign="top" align="left" width="246">
<form name="go" method="post" action="http://www.riteaid.com">
<select name="drugs_added" size="5" multiple>
<?
foreach ($check as $value) {
list ($gcn,$info) = split (",", $value);
?>
<option value="<?= $value?>"><?= $info?></option>
<? } ?>
</select><br>
<input type="hidden" name="checked" value="<?= $check?>">
<input type="submit" name="Go" value="Go">
</form>
</td>
</tr>