Why does a php/mysql query that creates a drop down separate option values?

retlav

New member
Hello guys...
I have a query that i hope you can look at.
Its a query that creates a drop down menu based on the contents of a table column.
It seems to work but if the the contents of the field the table gets broken up on. this is the html that is produced.
Thanks if anyone can help...

<td><div align="right">School</div></td>
<td><select id="dropdown-style" name="school" value="school"><option value="School" of="" business="">School of Business</option><option value="College" of="" liberal="" arts="">College of Liberal Arts</option></select></td>
</tr>

This is the Query...
<? $query_s="SELECT * FROM schools ORDER BY school DESC";

/* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */

$result_s = mysql_query ($query_s);
echo "<select id= 'dropdown-style' name=school value='school'>school</option>";
// printing the list box select command

while($nt_s=mysql_fetch_array($result_s)){//Array or records stored in $nt
echo "<option value=$nt_s[school]>$nt_s[school]</option>";
/* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box

?>
 
Back
Top