Forums

Adding checkbox data to meta key pair (1 post)

  1. lengluilengchai
    Member
    Posted 7 months ago #

    Hi All,

    How do i add the data from a checkbox as a meta key?? I tried googling alot , most of the google results pointed towards creating a meta box in the admin area. What i want is simple form processing if the user selects multiple value and these values are stored as part of the meta key for a given post. :P

    <form method = "post" action = "ppp.php">
    <input type = "checkbox" name = "mycheck[]" value = "orange">ORANGE
    <input type = "checkbox" name = "mycheck[]" value = "apple">APPLE
    <input type = "checkbox" name = "mycheck[]" value = "banana">BANANA
    <input type = "checkbox" name = "mycheck[]" value = "pear">PEAR
    <input type = "checkbox" name = "mycheck[]" value = "gauva">GUAVA
    <input type = "submit" name = "send" value = "SEND">
    </form>

    i tried the following but don't work..

    Do i need to do some serializing??

    add_post_meta($published_id, 'META_mycheck', $mycheck, true);

    And later do i extract the data using the get_post_data?? Do i need some foreach loop?

    Thanks, in advance..

Reply

You must log in to post.

About this Topic

  • RSS feed for this topic
  • Started 7 months ago by lengluilengchai
  • This topic is not resolved
  • WordPress version: 3.2.1