Doe zoals dit
function selectdata(){
$select="SELECT * FROM table_name";
$run=mysql_query($select);
$field_name = '';
while($fetch=mysql_fetch_array($run)){
$field_name.="<option value=''>" . $fetch['field_name'] . "</option>";
}
return $field_name;
}
En in html
<select name="office_name">
<?php echo selectdata(); ?>
</select>