Always use a DB when you can, makes it much easier to change params.
Here's a snippet you can use:
################### SELECT BOX CODE #######################
echo '
<td><SELECT NAME="change" SIZE="1">';
$sql = "SELECT * from ai.reports order by name";
$selections = get_rowset($conn_id,$sql);
foreach($selections as $selection){
echo '<OPTION';
$reptmp = $selection['name'];
if ($val == $reptmp){
echo ' SELECTED';
}
echo '>' . $selection['name'];
}
echo '</select></td>';
##########################################################
CAVEATS:
The get_rowset is a function we've written for retrieving an array from the
DB
The if $val == $reptmp is to check for whatshould be selected
Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"
mailto:[EMAIL PROTECTED]
http://accessingram.com
-----Original Message-----
From: Roland Perez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 11, 2003 11:03 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Code for drop down lists
I am a novice to PHP and am trying toget a survey with drop down lists.
I am stuck as to if I should connect to the DB (MySQL DB) to get the
values from a table or do I imbed them in the php file?
Thanks for any help in advance.
Roland Perez
[EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php