"auto populate a select box using an array in php" Answer’s


supposing the array looks like:

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

  <?php foreach($array as $key => $value) { ?>
    <option value="<?php echo $key ?>"><?php echo $value ?></option>
  <?php }?>
Wednesday, March 31, 2021
answered 10 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :