I'm trying to use the following code to populate 2 drop down boxes on my page...first dropdown box populates no problem, however I am not getting any data in the second, and I don't see why...what am I doing wrong? thanks
<?php
include("db_connect.php");
session_start();
session_register();
if (isset($_SESSION["uid"]))
$query = mysql_query("SELECT * FROM users where companyid = '$company'");
echo "<form action=\"assigncourse.php\" method=\"POST\"><select name=\"users\">
<option value=\"\" \"selected\">Select a User</option>";
while ($row = mysql_fetch_array($query))
{
echo "<option value=\"{$row['userid']}\">{$row['name']}</option>";
}
echo "</select>";
$query2 = mysql_query("SELECT * FROM Courses");
echo "<select name=\"courses\">
<option value=\"\" \"selected\">Select a Course</option>";
while ($row2 = mysql_fetch_array($query2))
{
echo "<option value=\"{$row2['courseid']}\">{$row['coursename']}</option>";
}
echo "</select>";
echo "<input type=\"submit\" value=\"Assign Course\"></form>";
?>