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 #174072 is a reply to message #174051] Fri, 20 May 2011 23:02 Go to previous messageGo to previous message
Jeff North is currently offline  Jeff North
Messages: 58
Registered: November 2010
Karma:
Member
On Fri, 20 May 2011 11:30:02 -0700 (PDT), in comp.lang.php Co
<vonclausowitz(at)gmail(dot)com>
<7e34dca3-a1f3-4bdf-acbd-8288e6a30581(at)gu8g2000vbb(dot)googlegroups(dot)com>
wrote:

> | Hi All,
> |
> | I am having trouble populating a pulldownbox with records from a table
> | in mySQL database.
> |
> | I have a table with personnel records.
> | One of the fields is partner which holds a numeric value pointing to
> | the id of another record.
> | I am trying to get the value of the currently selected person's
> | partner.
> |
> | for example:
> | id=1 name=John partner=2
> | id=2 name=Jane partner=1
> |
> | With the code I use I do get the pulldownbox filled but it doesn't
> | display the name right partner info in the box.
> |
> | $query="SELECT id, firstname, lastname, rank FROM myMembers WHERE id
> | <> $id ORDER BY lastname";
> | $result = mysql_query ($query);
> | echo "<select name=partner class=formFields id=partner
> | value=''>Partner</option>";
> | while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
> | echo "<option value=$nt[id]>$nt[rank] $nt[firstname] $nt[lastname]</
> | option>";
> | /* Option values are added by looping through the array */
> | }
> | echo "<option value=$partner>$nt[rank] $nt[firstname] $nt[lastname]</
> | option>";
> | echo "</select>";// Closing of list box
> | ?>
> |
> | Can anyone help me here?
> |
> | Regards
> | Marco

When you View Source of the page what do you see where the lists are
supposed to be (there could be php error messages hiding there).
[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: Sun Nov 24 00:51:09 GMT 2024

Total time taken to generate the page: 0.05761 seconds