Originally posted by bastien
are you geting anything in the array?
remember to have no spaces in the concatenation string
$check = $check.",".$add;
echo "check is ".$check;
and this
foreach ($check as $value)
should be
foreach($item as value){
let me know
When I use the above code, what echoes out on the screen is "check is ,Array". When I do a rint_r on $check, it also prints Array. Also, in my select box for the options, don't I need to have something like list ($gcn,$info) = split (",", $value); so I can print out my options? My code is below.
<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 -->"><br>
<input type="submit" name="Delete" value="<-- Remove"></td>
<?
$check = $check.",".$add;
echo "check is ".$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>
<?
$items = split(",",$check);
foreach ($items 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>