title: Save meta box data from selected dropdown list
body: <p>I'm trying to save some data in WordPress database from a meta box.</p>
  
  <p>I've got a dropdown list to select some options and I want to save the selected option in database thanks to meta box.</p>
  
  <p>However I have some difficulty with the save function in PHP :</p>
  
  <pre><code>&lt;?php
  
  function add_admin_menu_class_meta_box() {
      $pages = array('post', 'portfolio');
      foreach( $pages as $page ) {
          add_meta_box('custom_element_grid_class','Element grid size', 'custom_element_grid_class_meta_box', $page, 'side', 'high');
      }
  }
  add_action( 'admin_menu', 'add_admin_menu_class_meta_box' );
  
  function custom_element_grid_class_meta_box(){
  
      ?&gt;
  
      &lt;label&gt;Choose the size of the element :  &lt;/label&gt;
  
      &lt;select name="custom_element_grid_class" id="custom_element_grid_class"&gt;
        &lt;option value="normal" &lt;?php selected( $meta_element_class, 'normal' ); ?&gt;&gt;normal&lt;/option&gt;
        &lt;option value="square" &lt;?php selected( $meta_element_class, 'square' ); ?&gt;&gt;square&lt;/option&gt;
        &lt;option value="wide" &lt;?php selected( $meta_element_class, 'wide' ); ?&gt;&gt;wide&lt;/option&gt;
        &lt;option value="tall" &lt;?php selected( $meta_element_class, 'tall' ); ?&gt;&gt;tall&lt;/option&gt;
      &lt;/select&gt;
  
  
      &lt;?php
  }
  
  add_action('save_post', 'save_custom_element_grid_class');
  function save_custom_element_grid_class(){
  
  global $post;
  
  if(!isset($_POST["custom_element_grid_class"])):
      return $post;
      endif;
      update_post_meta($post-&gt;ID, 'custom_element_grid_class', $meta_element_class);
  }
  
  ?&gt;
  </code></pre>
  
  <p>How can I get the select value an save it with <code>update_post_meta()</code>?</p>