Re: Retaining listbox selections
| From: | Stuart Dallas | Date: | Fri, 20 Dec 2013 23:06:06 +0000 |
| Subject: | Re: Retaining listbox selections | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322588@lists.php.net to get a copy of this message | ||
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.
-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/