How to populate html combo box with mysql data

Posted by user225269 on Stack Overflow See other posts from Stack Overflow or by user225269
Published on 2010-05-05T02:14:12Z Indexed on 2010/05/05 2:18 UTC
Read the original article Hit count: 225

Filed under:
|
|

Please help, I'm having trouble loading mysql data on the combo box. The data that I'm loading is 1 column from a table. Here is my current code, and it crashed firefox for some reason:

<td colspan=”2?>Religion</TD>
<td>
<select name="REL" onClick="submitCboSemester();">
<?php
$query_disp="SELECT * FROM Religion ORDER BY RID";
$result_disp = mysql_query($query_disp, $conn);
while($query_data = mysql_fetch_array($result_disp))
{
?>
<option value="<? echo $query_data["RID"]; ?>"<?php if ($query_data["RID"]==$_POST['REL']) {?>selected<? } ?>><? echo $query_data["RELIGION"]; ?></option>
<? } ?>
</select>
</td>

The column is RELIGION and it ID is RID How do I populate the combo box with all the data in the column RELIGION

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql