Re: populate pulldownbox from query [message #174089 is a reply to message #174088] |
Sat, 21 May 2011 11:39 |
Co
Messages: 75 Registered: May 2011
Karma:
|
Member |
|
|
On 21 mei, 13:00, t...@mountifield.org (Tony Mountifield) wrote:
> In article <cddfd7a4-dfb5-48c0-8ecc-e2c86baaf...@glegroupsg2000goo.googlegroups.com>,
>
> Co <comp(dot)lang(dot)php(at)googlegroups(dot)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: t...@softins.co.uk -http://www.softins.co.uk
> Play: t...@mountifield.org -http://tony.mountifield.org
should that be in this sentence?
echo "<option value=$nt[id]>{$nt['rank']} {$nt['firstname']}
{$nt['lastname']} </option>";
Marco
|
|
|