Assigning Values to Variables
I am trying to create a list box of the contents of a field in a MySQL database using the code below:
<td width="70%"><select name="QuizType">
<?php
$link_id = mysql_connect("localhost","phpuser","phppass");
$recordset = mysql_query("SELECT * FROM jpquiz.QuizTypes ORDER BY TypeIndex");
While($query_data = mysql_fetch_row($recordset))
{
$QuizType = $query_data["QuizType"];
echo "<option value=\"";
echo $QuizType;
echo "\">";
echo $QuizType;
echo "</option>\n";
}
echo "</select>\n";
The form displays OK and does not return any errors. The list box has four rows as it should but they are all blank. After messing around with it for a little while it seems that the value is not being assigned correctly to $QuizType.
Can anyone tell me what I am doing wrong?
Thanks in advance,
Glen
|