---
<SELECT name = "username">
<OPTION selected>--- Please Choose a Username ---</OPTION>
<?php
// retrieve a list of usernames from the DB
$results = mysql_query("SELECT userID, username FROM users")
or die ("could not perform requested query");
// make sure we got a list of usernames back
if (mysql_num_rows($results) != 0)
{
// process the returned results
for ($i = 0; $i < mysql_num_rows($results); $i++)
{
// get a row of results back from the result set
$row = mysql_fetch_array($results);
// construct the dropdown menu item
echo "<OPTION value = \"" . $row["userID"] . "\">" . $row["username"] . "</OPTION>";
}
}
else
{
echo "No names in the database";
}
?>
</SELECT>
Of course you need to embed this within a <FORM> tag.
-Pete
---
On Sun, 2004-01-18 at 01:18, BigMark wrote:
Is it possible to have usernames from my db populated into a drop down list. If so What and where does it go to make it all work, ive tried everything i know ( which is not much by the way). Mark
-- perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")' |
signature.asc
Description: This is a digitally signed message part