Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. <?php
  2.  
  3.     public static function dropMenu($list, $getName){
  4.         foreach($list as $item){
  5.             if(($_SERVER['REQUEST_METHOD'] == 'POST') && $_POST[$getName] == $item['id']) {
  6.                 echo '<option selected="selected">' . $item['name'] . "</option>";
  7.             }
  8.             else if (($_SERVER['REQUEST_METHOD'] == 'GET') && $_GET[$getName] == $item['id']) {
  9.                 echo '<option selected="selected">' . $item['name'] . "</option>";
  10.             }
  11.             else {
  12.                 echo '<option>' . $item['name'] . "</option>";
  13.             }
  14.         }
  15.     }
  16.  
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement