'; } else { // get records for pulldown $q1 = "select * from team_sample order by teamName "; $r1 = mysql_query($q1) or die(mysql_error()); $picklist = "\n
\n

\n

\n
\n" ; ?>
Generate a Pulldown Menu

It is often useful to have a user make a selection based on data in a database table.

Let's look at some pseudo code to illustrate the process:

<?php
// initialize
if isset(submit_button)
{
    validate variables
    take some action
    exit
}
get database selection set
create html select statement
?>
display the form with pulldown menu

Here is a sample, created from a data table:

Source code.