title: Update option in WordPress
body: <p>I am creating admin theme option in WordPress, Everything works perfectly except one function "Updating option"  when I make changes through options admin panel and save changes, I get message "options settings saved." but when I check my page I see nothing is changed. </p>
  
  <p>Here is my code for updating or save option: </p>
  
  <pre><code> function mytheme_add_admin() {
  
      global $themename, $shortname, $options;
  
      if ( $_GET['page'] == basename(__FILE__) ) {
  
          if ( 'save' == $_REQUEST['action'] ) {
  
              foreach ($options as $value) {
                  update_option( $value['id'], $_REQUEST[ $value['id'] ] ); 
              }
  
              foreach ($options as $value) {
                  if( isset( $_REQUEST[ $value['id'] ] ) ) 
                  { 
                      update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); 
                  } 
                  else {
                      delete_option( $value['id'] ); 
                  } 
              }
  
              header("Location: admin.php?page=functions.php&amp;saved=true");
              die;
  
          } 
          else if( 'reset' == $_REQUEST['action'] ) {
  
              foreach ($options as $value) {
                  delete_option( $value['id'] ); 
              }
  
              header("Location: admin.php?page=functions.php&amp;reset=true");
              die;
  
          }
      }
  
      add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');
  }
  
  function mytheme_add_init() {
  
  }
  </code></pre>
  
  <p>What is wrong with my code?</p>