Guest User

Untitled

a guest
Feb 19th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. $customField['option1'] = 'value1';
  2. $customField['option2'] = 'value2';
  3. $customField['option3'] = 'value3';
  4.  
  5. echo generateSelect('Category', $customField)
  6.  
  7. function generateSelect($name = '', $options = array()) {
  8.     $html = '<select name="'.$name.'">';
  9.     foreach ($options as $option => $value) {
  10.         $html .= '<option value='.$value.'>'.$option.'</option>';
  11.     }
  12.     $html .= '</select>';
  13.     return $html;
  14. }
Add Comment
Please, Sign In to add comment