Re: Dropdown menus from DB query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sorry, these codes are not tested... yes, i missed a quotation mark on the
first echo statement.

it should read:

echo "<select name=\"dropdown\">";

but i guess you can figure it out from these.. good luck! :o)

----- Original Message ----- 
From: "Cole Ashcraft" <cole.ashcraft@xxxxxxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Friday, June 18, 2004 9:23 AM
Subject: Re:  Dropdown menus from DB query


> Thanks. I think I can work from this. Just to let you know, it generates
> a parse error ( I think its because of the quotes).
>
> Cole
>
> On Thu, 2004-06-17 at 18:09, Ng Hwee Hwee wrote:
> > hmm... what about something like this??
> >
> > echo "<select name=\"dropdown\">;
> >
> > $query = "select code, name from table";
> >
> > $result = mysql_query($query);
> >
> > while($array = mysql_fetch_array($result))
> > {
> >     echo "<option
value=\"".$array["code"]."\">".$array["name"]."</option>";
> > }
> >
> > echo "</select>";
> >
> > hth
> >
> > ----- Original Message ----- 
> > From: "Cole Ashcraft" <cole.ashcraft@xxxxxxxxxxxxxxxxxx>
> > To: <php-db@xxxxxxxxxxxxx>
> > Sent: Friday, June 18, 2004 7:50 AM
> > Subject:  Dropdown menus from DB query
> >
> >
> > > How would you create a drop down menu from a database query? I have
> > > figured how to do it with one field, but how could it be done with a
> > > system where the value is different than the displayed value (ie.
> > > numerical code as the value, name displayed)?
> > >
> > > Thanks,
> > > Cole
> >
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is believed to be clean.
>
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux