Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Drop Down Selection From Database

by cadfael (Friar)
on Jan 26, 2001 at 18:26 UTC ( [id://54544]=note: print w/replies, xml ) Need Help??


in reply to Drop Down Selection From Database

One thing to consider is whether you want this to be a controlled vocabulary. i.e. Are there a limited number of choices that you want people to have? If this is the case, then they can be hard coded into a pull-down form.

If, on the other hand, you want to generate the current list of comapny names reflecting recent additions, then you would need to do something like this:

select distinct ID_no, Company_Name from Companies order by CompanyName
(I put in an ID_no assuming that this is a relational database and you are using surrogate keys. You may need them further along in the query form)

Then you would take the array returned by the SELECT and use it to populate the drop-down list.

-----
"Computeri non cogitant, ergo non sunt"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://54544]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found