Results 1 to 1 of 1

Thread: 2nd Dropdown is not saving data.

  1. #1
    Join Date
    Jul 2014
    Thanked 0 Times in 0 Posts

    Default 2nd Dropdown is not saving data.

    I have a select list in a metabox which value is saved successfully after clicking "Update" when editing post. Of course, the values are custom taxonomies. But i don't know how to add another select list and make it save its values successfully too...

    PHP Code:
    add_action( 'add_meta_boxes', 'so_custom_meta_box' );

    function so_custom_meta_box($post){
    add_meta_box('so_meta_box', 'Reproductor 1', 'custom_element_grid_class_meta_box',     $post->post_type, 'normal' 

    , 'high');

    add_action('save_post', 'so_save_metabox');

    function so_save_metabox(){ 
    global $post;

        $meta_element_class = $_POST['custom_element_grid_class'];
        //END OF UPDATE

        update_post_meta($post->ID, 'custom_element_grid_class_meta_box',   $meta_element_class);

    function custom_element_grid_class_meta_box($post){
    $meta_element_class = get_post_meta($post->ID, 'custom_element_grid_class_meta_box', true); ?>   

      <select name="custom_element_grid_class" id="custom_element_grid_class">
      <option value="Netu" <?php selected$meta_element_class'Netu' ); ?>>Netu</option>
      <option value="Netu-latino" <?php selected$meta_element_class'Netu-latino' ); ? >>Netu Latino</option>
    option value="Netu-castellano" <?php selected$meta_element_class'Netu- castellano' ); ?>>Netu Castellano</option>
      <option value="Netu-vose" <?php selected$meta_element_class'Netu-vose' ); ?>>Netu    Vose</option>

      <select name="custom_element_grid_class" id="custom_element_grid_class">
      <option value="Vk" <?php selected$meta_element_class'Vk' ); ?>>Vk</option>
      <option value="Vk-latino" <?php selected$meta_element_class'Vk-latino' ); ?>>Vk  Latino</option>
      <option value="Vk-castellano" <?php selected$meta_element_class'Vk-castellano' );  ?>>Vk Castellano</option>
      <option value="Vk-vose" <?php selected$meta_element_class'Vk-vose' ); ?>>Vk    Vose</option>

    Only the first select list values are saved when i click update, but not the second. I already know this has to be with the save code but i can't figure out how to be able to modify it so i can put a second select list and its value can be saved.
    Last edited by Rodrigo8; 07-15-2014 at 07:24 AM.

Similar Threads

  1. Saving Data with Java?
    By ceerup in forum JavaScript
    Replies: 7
    Last Post: 05-01-2012, 10:31 PM
  2. checklist to remove from db
    By baconDelta in forum PHP
    Replies: 9
    Last Post: 01-29-2012, 05:43 AM
  3. Alert/Confirm box for saving data
    By newphpcoder in forum JavaScript
    Replies: 1
    Last Post: 12-19-2011, 03:18 PM
  4. Saving on the server and recalling data
    By nielse63 in forum PHP
    Replies: 4
    Last Post: 09-12-2009, 11:30 PM
  5. Replies: 12
    Last Post: 09-26-2006, 10:01 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts