title: how to save a select option dropdown in a wordpress plugin
body: <p>i have the following code that is taken from the WordPress codex on how to save a simple text input field. it works fine. but i am trying to now save a select option dropdown and can't figure out what i am missing here. it seems it saves the first time i hit save from the dropdown, but when i try to edit the value to select another option and save it, it never saves.</p>
  
  <p>my other queston is why is the value not being printed to the screen when i run</p>
  
  <pre><code>testing value saved: &lt;?=esc_attr( get_option('location_one_option') ); ?&gt;
  </code></pre>
  
  <p>the current plugin code is below:</p>
  
  <pre><code>// create custom plugin settings menu
  function sidebar_posts_create_menu() {
      //create new top-level menu
      add_menu_page('Sidebar Posts', 'Sidebar Post Settings', 'administrator', __FILE__, 'sidebar_posts_settings_page' );
  
      //call register settings function
      add_action( 'admin_init', 'register_sidebar_posts_settings' );
  }
  add_action('admin_menu', 'sidebar_posts_create_menu');
  
  //register our settings
  function register_sidebar_posts_settings() {
      //register our settings
      register_setting( 'sidebar-posts-settings-group', 'location_one_option' );
      register_setting( 'sidebar-posts-settings-group', 'new_option_name' );
  }
  
  //register settings page view
  function sidebar_posts_settings_page() {
      ?&gt;
      &lt;div class="wrap"&gt;
          &lt;h1&gt;Sidebar Posts Settings&lt;/h1&gt;
          &lt;p&gt;Select up to six posts to show in six different locations on the sidebar. Have fun!&lt;/p&gt;
  
          &lt;form method="post" action="options.php"&gt;
              &lt;?php settings_fields( 'sidebar-posts-settings-group' ); ?&gt;
              &lt;?php do_settings_sections( 'sidebar-posts-settings-group' ); ?&gt;
              &lt;table class="form-table"&gt;
                  &lt;tr valign="top"&gt;
                      &lt;th scope="row"&gt;New Option Name&lt;/th&gt;
                      &lt;td&gt;&lt;input type="text" name="new_option_name" value="&lt;?php echo esc_attr( get_option('new_option_name') ); ?&gt;" /&gt;&lt;/td&gt;
                  &lt;/tr&gt;
  &lt;!--the above simple text field saves the data perfectly--&gt;
  
                  &lt;?php
                  $your_query = new WP_Query( 'posts_per_page=-1' ); ?&gt;
                                  &lt;label&gt;Location One Post&lt;/label&gt;&lt;br /&gt;
              &lt;select name="location_one_option"&gt;
                  &lt;option value="" selected="selected"&gt;Select a post&lt;/option&gt;
                  &lt;?php while ( $your_query-&gt;have_posts() ) : $your_query-&gt;the_post(); ?&gt;
                  &lt;option value="&lt;?=esc_attr( get_option('location_one_option') ); ?&gt;" &lt;?php selected( get_option('location_one_option'), get_option('location_one_option') ); ?&gt;&gt;
                      &lt;?=the_title(); ?&gt;
                  &lt;/option&gt;
                  &lt;? endwhile; ?&gt;
              &lt;/select&gt;
              &lt;? wp_reset_postdata(); ?&gt;&lt;br /&gt;&lt;br /&gt;
              testing value saved: &lt;?=esc_attr( get_option('location_one_option') ); ?&gt;
  
              &lt;/table&gt;
              &lt;?php submit_button(); ?&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;?php }
  </code></pre>