title: Save Selected Option in Meta Box
body: <p>i am going to build my own theme
  I try to add select to post_type meta box, but every update post my select not on selected option but show the first option (blank value)</p>
  
  <p>here is my code</p>
  
  <pre><code>function mhs_data() {
          global $post;
          echo '&lt;input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' .
          wp_create_nonce( plugin_basename(__FILE__) ) . '" /&gt;';
  
          $nisn = get_post_meta($post-&gt;ID, '_nisn', true);
          $rel = get_post_meta($post-&gt;ID, '_rel', true);
      }
  
              echo '&lt;p&gt;NISN&lt;/p&gt;';
              echo '&lt;input type="text" name="_nisn" value="' . $nisn  . '" class="widefat" /&gt;';
              echo '&lt;p&gt;Relationship&lt;/p&gt;'; ?&gt;
  
              &lt;select name="_rel" id="_rel"&gt;
                  &lt;option value=""&gt;Relationship&lt;/option&gt;
                  &lt;option value="Single" &lt;?php selected( $rel, 'Single' ); ?&gt;&gt;Single&lt;/option&gt;
                  &lt;option value="Marry" &lt;?php selected( $rel, 'Marry' ); ?&gt;&gt;Marry&lt;/option&gt;
              &lt;/select&gt;
  
              &lt;?php 
      }
  
      function mhs_data_meta($post_id, $post) {
          if ( !wp_verify_nonce( $_POST['eventmeta_noncename'], plugin_basename(__FILE__) )) {
          return $post-&gt;ID;
          }
          if ( !current_user_can( 'edit_post', $post-&gt;ID ))
              return $post-&gt;ID;
  
          $events_meta['_nisn'] = $_POST['_nisn'];
          $events_meta['_rel'] = $_POST['_rel'];
  
          foreach ($events_meta as $key =&gt; $value) { 
              if( $post-&gt;post_type == 'revision' ) return; 
              $value = implode(',', (array)$value); 
              if(get_post_meta($post-&gt;ID, $key, FALSE)) { 
                  update_post_meta($post-&gt;ID, $key, $value);
              } else {
                  add_post_meta($post-&gt;ID, $key, $value);
              }
              if(!$value) delete_post_meta($post-&gt;ID, $key);
          }
      }
  
      add_action('save_post', 'mhs_data_meta', 1, 2);
  </code></pre>
  
  <p>Please help me to correct my code</p>