title: Wordpress Custom Widget Select Options Not Saving
body: <p>I'm very new to coding Wordpress plugins/widgets (this is my first time!). I've built a very basic Wordpress plugin which consists of 2 text inputs and a select field. The text inputs work fine however the select box doesn't appear to be saving when I hit the "Save" button.</p>
  
  <p>Here is my plugin code:</p>
  
  <pre><code>&lt;?php
  /* Plugin Name: Sidebar Box
  Plugin URI: http://www.website.com
  Description: Displays contact box in sidebar
  Version: 1.0
  Author: JM
  Author URI: N/A
  */
  
  // use widgets_init action hook to execute custom function
  add_action( 'widgets_init', 'jm_box_widget' );
  
   //register our widget
  function jm_box_widget() {
      register_widget( 'jm_box_widget_my_info' );
  }
  
  //boj_widget_my_info class
  class jm_box_widget_my_info extends WP_Widget {
  
      //process the new widget
      function jm_box_widget_my_info() {
          $widget_ops = array( 
              'classname' =&gt; 'jm_box_widget_class', 
              'description' =&gt; 'Sidebar Box Widget.'
              ); 
          $this-&gt;WP_Widget( 'jm_box_widget_my_info', 'Box Widget', $widget_ops );
      }
  
       //build the widget settings form
      function form($instance) {
          $defaults = array( 'title' =&gt; 'Box Page Widget', 'description' =&gt; '', 'boxtype' =&gt; '' ); 
          $instance = wp_parse_args( (array) $instance, $defaults );
          $title = $instance['title'];
          $description = $instance['description'];
          $boxtype = $instance['boxtype'];
  
          ?&gt;
              &lt;p&gt;Title: &lt;input class="widefat" name="&lt;?php echo $this-&gt;get_field_name( 'title' ); ?&gt;"  type="text" value="&lt;?php echo esc_attr( $title ); ?&gt;" /&gt;&lt;/p&gt;
              &lt;p&gt;Description: &lt;textarea class="widefat" name="&lt;?php echo $this-&gt;get_field_name( 'description' ); ?&gt;" / &gt;&lt;?php echo esc_attr( $description ); ?&gt;&lt;/textarea&gt;&lt;/p&gt;
      &lt;p&gt;Sex:
              &lt;select id="&lt;?php echo $this-&gt;get_field_id( 'boxtype' ); ?&gt;" name="&lt;?php echo $this-&gt;get_field_name( 'boxtype' ); ?&gt;" class="widefat" style="width:100%;"&gt;
              &lt;option &lt;?php if ( 'box1' == $instance['format'] ) echo 'selected="selected"'; ?&gt; value="box1"&gt;box1&lt;/option&gt;
      &lt;option &lt;?php if ( 'box2' == $instance['format'] ) echo 'selected="selected"'; ?&gt; value="box2"&gt;box2&lt;/option&gt;
              &lt;/select&gt;
          &lt;/p&gt;
          &lt;?php
      }
  
      //save the widget settings
      function update($new_instance, $old_instance) {
          $instance = $old_instance;
          $instance['title'] = strip_tags( $new_instance['title'] );
          $instance['description'] = strip_tags( $new_instance['description'] );
          $instance['boxtype'] = ( $new_instance['boxtype'] ); 
          return $instance;
      }
  
      //display the widget
      function widget($args, $instance) {
          extract($args);
  
          echo $before_widget;
          $title = apply_filters( 'widget_title', $instance['title'] );
          $description = empty( $instance['description'] ) ? '&amp;nbsp;' : $instance['description']; 
          $boxtype = empty( $instance['boxtype'] ) ? '&amp;nbsp;' : $instance['boxtype']; 
  
          echo '&lt;div class="sidebar-box" id="' . $boxtype . '" onmouseover="this.style.cursor=\'pointer\'" onmouseup="window.location=\'' . $boxtype . '\'"&gt;
                  &lt;h3&gt;' . $title . '&lt;/h3&gt;
                  &lt;p&gt;' . $description . '&lt;/p&gt;
                  &lt;/div&gt;';
          echo $after_widget;
      }
  }
  </code></pre>
  
  <p>?></p>
  
  <p>I can't for the life of me workout why it's not saving.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks,</p>
  
  <p>James</p>