Adding checkbox data to meta key pair
-
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. ??
<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..
- The topic ‘Adding checkbox data to meta key pair’ is closed to new replies.