that are populated using the database. I receive this error:
No database selected
SELECT Name FROM Teams
Name is a field inside the Teams table if this helps.
Here is the code I am using:
<?php
$user = "";
$host = "";
$password = "";
$dbName = "olevetpo_polls";
/* make connection to database */
mysql_connect($host, $user, $password) OR DIE( "Unable to connect
to database");
mysql_select_db($dbName); //did you forget this line?
$sql = "SELECT Name FROM Teams";
$query = mysql_query($sql) or die(mysql_error() . "<br>$sql"); //use the or die(...) part ONLY IN DEVELOPMENT
?>
<form action="action" method="post">
<select name="option">
<?php
while ($row = mysql_fetch_array($result)) {
echo "<option value=\"" . $row['Name'] . "\">" . $row['Name'] . "</option>\n";
}
?>
</select>
<input type="submit">
</form>
I left the database name, but not the rest for obvious reasons.
First, I am a big time noob when it comes to php, I found this code here at phpfreaks. I do know that this only shows one drop list....
With that said, I need some other help too....
I am trying to create a college football human poll, so I need 24 more of these drop downs (stacked on top of each other and with #1, #2, #3, etc preceeding the dropdowns), but only one submit, after the final list.
How would I do this?