0

I'm trying to update my code with little success.

  <?php
  reset($gb_options);
  while (list(, $gb_opts) = each($gb_options)) {
  echo('          <option value="'.$gb_opts.'">'.$gb_opts.'</option>'."\n"); 
 } 
?>
  • 1
    Use [`foreach`](https://www.php.net/manual/en/control-structures.foreach.php). What did you try? – Jeto Nov 17 '19 at 11:14

1 Answers1

1

Try this:

<?php
  reset($gb_options);

  foreach ($gb_options as $option) {
    echo('          <option value="' . $option[1] . '">' . $option[1] . '</option>'."\n"); 
  }

?>
Karolis
  • 2,580
  • 2
  • 16
  • 31
  • Thanks for getting back to me. Unfortunately if I use your suggestion I lose the drop down options. It's a contact form here - https://www.voip4eu dotcom/contact.php – Phil Matthews Nov 18 '19 at 10:14