I am attempting to populate a dropdown box with a set of records, but executing the following code results in "Parse error: syntax error, unexpected T_STRING, expecting ',' or ';', referring to
$sql = "SELECT cat_id, cat_name FROM ehamfest_categories ORDER BY cat_name";
I can't, for the life of me, figure out where the problem is. I also know there is a problem with code that is to be executed in the while statement.
Any help would be greatly appreciated! 😃
Thank you,
Chris
case "CreateCategory":
echo "<form name=\"CreateCategory\" action=\"ehamfest.php?action=AddCategory\" method=\"post\">
Name: <input type=\"text\" name=\"cat_name\"><br>
Description: <input type=\"text\" name=\"cat_description\"><br>
Parent Category: <select name=\"cat_parent\">
// Retrieve all categories from the database where cat_parent=0.
// For each category, list all categories where cat_parent = current category.
// Sort categories alphabetically.
db_connect();
db_select();
$sql = "SELECT cat_id, cat_name FROM ehamfest_categories ORDER BY cat_name";
$rs = mysql_query($sql);
while($row = mysql_fetch_array($rs))
{
echo "<option value=\"".$row['cat_id']."\">".$row['cat_name']."\n ";
}
</select><br>
<input type=\"submit\" value=\"Add Category\">
</form>";
break;