Posted by mootmail-googlegroups on 08/23/06 19:14
deko wrote:
> This seems to be working:
>
> <form name="bgcolor" action="http: // www . example . com/ks123/?p=85"
> method="post">
> <select name=color onChange="bgcolor.submit()">
> <option value=white>white</option>
> <option value=yellow>yellow</option>
> </select>
> </form>
>
> BUT, after the page posts back, the option value in the combo box reverts back
> to 'white' rather than sticking with what the user just selected.
>
> How do I get it to stick with the user's choice on post back? Do I have to grab
> that value with PHP code and then set the combo default manually? How?
Yes, you will need to set the selected option manually.
Try something like this:
<form name="bgcolor" action="http: // www . example . com/ks123/?p=85"
method="post">
<select name=color onChange="bgcolor.submit()">
<option value=white
<?=($_POST['color']=='white'?'selected':'')?>>white</option>
<option value=yellow
<?=($_POST['color']=='yellow'?'selected':'')?>>yellow</option>
</select>
</form>
Navigation:
[Reply to this message]
|