If i had a select box
<select><option>...<option></select>
and I had an array of values from 1-12
using php, how would I auto populate that select box using that array?
supposing the array looks like:
$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>
2.1m questions
2.1m answers
60 comments
57.0k users