"retrieving data through mysql using function and use in the select box?" Code Answer

2

do like this

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;
}

and in html

<select name="office_name">
<?php echo selectdata(); ?>
</select>
By Gijo Varghese on May 23 2022

Answers related to “retrieving data through mysql using function and use in the select box?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.