Lakukan seperti ini
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;
}
Dan di html
<select name="office_name">
<?php echo selectdata(); ?>
</select>