FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » populate pulldownbox from query
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: populate pulldownbox from query [message #174088 is a reply to message #174060] Sat, 21 May 2011 11:00 Go to previous messageGo to previous message
tony is currently offline  tony
Messages: 19
Registered: December 2010
Karma:
Junior Member
In article <cddfd7a4-dfb5-48c0-8ecc-e2c86baaff2e(at)glegroupsg2000goo(dot)googlegroups(dot)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: tony(at)softins(dot)co(dot)uk - http://www.softins.co.uk
Play: tony(at)mountifield(dot)org - http://tony.mountifield.org
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: he
Next Topic: Detecting Redirected Output
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 06:19:44 GMT 2024

Total time taken to generate the page: 0.04187 seconds