Hi there:)

I use odbc so you'll have to change your functions if you're using mysql


//connect to db
$connectionToDB = odbc_connect("cdconsultant", "joecon", "joecon");


//create query statement
$sqlr = "SELECT DISTINCT category FROM CONSULTANT ORDER BY category" ;
//execute the sql statement (query) on the connection made
$resultset = odbc_do($connectionToDB, $sqlr);


print "<form name='myform' method='get' action='processingpage.php'><select
name='category'>";
//loop through the category field and dump into select box
while(odbc_fetch_row($resultset)){
$category = odbc_result($resultset,1);
print "<option value='$category'>$category</option>";
}
print "</select><font face='Verdana, Arial, Helvetica, sans-serif' size='2'
color='#663399'>Category</font>";

print "<input type='submit' name='Submit3' value='Search'>";
print "</form>";




// close the connection
odbc_close($connectionToDB);



Hope this helps, Joe :)

Alvin Ang <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED].;
> Hi there,
>
> I was wondering if anyone would be kind enough to show me how to select a
> field from a table in mysql and display it in a drop-down combo box?
>
> I am trying to show my users a list of all the parts from a table so that
> they can edit or delete it.
>
> Thanks!
>
> Alvin
>



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

Reply via email to