i try to get data from mysql db into html dropdown , i execute the query in PHPmyadmin and its work fine , the result is one record,and all the website is connected with theses details of MYSQL my code is :
<?php
mysql_connect("localhost", "root", "1212") or die("Connection Failed");
mysql_select_db("test")or die("Connection Failed");
$query = "SELECT department_name FROM department";
$result = mysql_query($query);
?>
<label for="department" > Department Name </label>
<select name="departments" >
<?php
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
?>
<option value="<?php echo $line['field'];?>"> <?php echo $line['field'];?> </option>
<?php
}
?>
</select>
the output is drop-down with one empty record , any one can help me in that ?