Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function create_dropdown($arr, $id){
- echo '<label for="' . $id . '">';
- echo '<select name="' . $id . '" id="' . $id .'">';
- if(isset($_POST[$id])){
- $sel = 'selected = selected';}
- else{ $sel = ''; }
- foreach($arr as $key => $val){
- echo '<option value="' . $key . '"' . $sel . '>' . $val . '</option>';
- }
- echo '</select>';
- }
- /**$test = array('supplier' => 's', 'customer' => 'c');
- create_dropdown($test, 'yolo');**/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement