Re: Retaining listbox selections
| From: | Larry Martell | Date: | Sat, 21 Dec 2013 18:48:46 +0000 |
| Subject: | Re: Retaining listbox selections | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322591@lists.php.net to get a copy of this message | ||
On Fri, Dec 20, 2013 at 6:06 PM, Stuart Dallas <stuart@3ft9.com> wrote:
> On 20 Dec 2013, at 23:03, Larry Martell <larry.martell@gmail.com> wrote:
>
>> I have a listbox and when the user selects items they are highlighted. Then
>> I process the form and when I generate the next web page (which has the
>> listbox) I want the selected items still to be highlighted. Can I do this
>> from PHP when I generate the listbox or must that be done client side from
>> javascript?
>
> This is pretty basic HTML. Simply add the attribute selected="selected" to the option
> tag you want to be selected. You could do it in Javascript, but since you already have PHP
> generating the form you might as well do it there.
Thanks.