Re: Combo Box containing field
| From: | Web Admin | Date: | Sat, 10 Mar 2001 12:22:22 +0000 |
| Subject: | Re: Combo Box containing field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-43301@lists.php.net to get a copy of this message | ||
Hi Michael,
Yes I do! Take a look at the code snippet below:
echo "<select name=something>";
$level2 = $db->execute("select typename from types");
do {
$value=$level2->fields[0];
echo "<option value=$value>$value</option>";
$level2->nextRow();
} while (!$level2->EOF);
$level2->close();
echo "</select>";
Just change the query in the 2nd line of the code to the
desired query. You'll see the result ;-)
Best of luck,
Ahmad Anvari da Code Guru
----- Original Message -----
From: RealGM
To: php-general@lists.php.net
Sent: Saturday, March 10, 2001 4:21 PM
Subject: [PHP] Combo Box containing field
Hi,
Does anyone know how I can create a combo box in my php file that reads the options in from a
database field?
I can create combo boxes fine containing values that I enter, but I want it to read the values
from the database into the drop down box for the user to select.
Thanks,
Michael.