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 #174091 is a reply to message #174089] Sat, 21 May 2011 12:09 Go to previous messageGo to previous message
crankypuss is currently offline  crankypuss
Messages: 147
Registered: March 2011
Karma:
Senior Member
Co <vonclausowitz(at)gmail(dot)com> wrote:

> 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

This is none of my business, but in my experience writing long lines
of cryptic code is inherently bad. First off, if you get one
character wrong it doesn't work and then there you are. Secondly, the
next guy to pick up your code is going to have to decrypt it all.
Thirdly, if you use several lines of code it's easier to relate an
error message to the offending code, and if you should be so lucky as
to be using an interactive debugger it'll step through each line and
you can actually see what's going on. jmo.

--
no aluminum siding offers today
[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:57 GMT 2024

Total time taken to generate the page: 0.04604 seconds