Posted by Bocah Sableng on 05/03/07 09:26
On May 3, 11:45 am, tks...@gmail.com wrote:
> How can I determine the values of a listbox, both unselected or
> selected after submitting the form:
>
> Code:
>
> <select name="sel1" size="10" multiple="multiple">
> <? PHP code populates listbox ?>
> </select>
>
Add hidden elements to your form, set the values same as value of your
options.
Untested code:
<select name="sel1[]" size="10" multiple="multiple">
<?php foreach ($arr as $k=>$v) { ?>
<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
<?php } ?>
</select>
<?php foreach ($arr as $k=>$v) { ?>
<input type=hidden name="sel1all[]" value="<?php echo $k; ?>">
<?php } ?>
HTH.
[Back to original message]
|