i write a program to retrieve the data through MySQL using function now i have a problem that how i use it in the select box?
Code for this is given below,
function selectdata(){
$select="SELECT * FROM table_name";
$run=mysql_query($select);
while($fetch=mysql_fetch_array($run)){
$field_name.=$fetch['field_name'];
}
return $field_name;
}
HTML:
<select name="office_name">
<option value=""><?php echo selectdata(); ?></option>
</select>
it is showing all the data in one field
any help??