Hello;
I am trying to get the following code to work, it is supposed to populate a dropdown menu from a MySQL database. However all I get are error messages, What is wrong with the code? The tabel I want to access is called "catagory" and I want to get the name and ID info into the menu, the name to display and the ID to control where you go to when you select it.
<?
$DATABASE_HOST="localhost";
$DATABASE_USER="httpd";
$DATABASE_PASSWORD="";
$DATABASE_NAME="freetrade";
mysql_connect($DATABASE_HOST,$DATABASE_USER,$DATABASE_PASS);
function makeDrop ($table,$idname,$idlabel)
{
global $DATABASE_NAME;
$results=mysql_db_query($DATABASE_NAME,"select $idname,$idlabel from $table order by
$table.$idlabel asc");
while($row=mysql_fetch_array($results)){
$Options.=<option value=".$row[$idname].">.$row[$idlabel].</option>;
}
return $Options;
}
?>
<select name="code">
<? echo makeDrop("codes","codeID","codeName"); ?>
</select>
SHAWN