Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php populate select from array

$array = array(
  1=>"My first option",
  2=> "My second option"
);

<select>
  <?php foreach($array as $key => $value) { ?>
    <option value="<?php echo $key ?>"><?php echo $value ?></option>
  <?php }?>
</select>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #populate #select #array
ADD COMMENT
Topic
Name
2+7 =