Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #1736

Re: populate pulldownbox from query

From tony@mountifield.org (Tony Mountifield)
Newsgroups comp.lang.php
Subject Re: populate pulldownbox from query
Date 2011-05-21 11:00 +0000
Organization Software Insight Ltd., Winchester, UK
Message-ID <ir8613$9gh$1@softins.clara.co.uk> (permalink)
References <cddfd7a4-dfb5-48c0-8ecc-e2c86baaff2e@glegroupsg2000goo.googlegroups.com>

Show all headers | View raw


In article <cddfd7a4-dfb5-48c0-8ecc-e2c86baaff2e@glegroupsg2000goo.googlegroups.com>,
Co  <comp.lang.php@googlegroups.com> wrote:
> I don't think the formatting is the problem.
> The problem is that the values are not set in the pulldownbox.
> It does populate the box with the names but the value from the database
> for the current record is not displayed.
> 
> Marco

What you need to do, within the loop that outputs the <option> elements,
is to check the value(s) in the row to see if this is the element that
should be currently displayed, and it so, you need to add the "selected"
tag to the <option> element, e.g.

<option id="$id" selected>$optiontext</option>

For all other options, omit the "selected".

Cheers
Tony
-- 
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-20 14:02 -0700
  Re: populate pulldownbox from query Jerry Stuckle <jstucklex@attglobal.net> - 2011-05-20 18:24 -0400
  Re: populate pulldownbox from query tony@mountifield.org (Tony Mountifield) - 2011-05-21 11:00 +0000
    Re: populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-21 04:39 -0700
      Re: populate pulldownbox from query crankypuss <no@email.thanks> - 2011-05-21 06:09 -0600
    Re: populate pulldownbox from query Co <vonclausowitz@gmail.com> - 2011-05-21 05:08 -0700

csiph-web