JoseMoralez

Select Menu Populated From Array (Needs Links)

May 6th, 2018
157
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $countries = array("United States", "Canada", "Russia", "China", "Japan");
  2.  
  3. echo "<select name='countries'>";
  4. echo "<option selected='selected'>Select a Country</option>";
  5.  
  6. foreach($countries as $option){
  7. echo "<option value={$option}>{$option}</option>"; 
  8. }
  9. echo "</select>";
RAW Paste Data