I need to do an import of an array of checkboxes, but there is a value that I don't how it is determined.
The array is based on a user meta option that I created that shows a list of category checkbox options. It grabs all of the categories and creates a checkbox option that can be saved to a user's profile.
This is part of the coding I used to create the user meta option:
$args = array( 'hide_empty' => 0, 'taxonomy'=> 'category');
$categories = get_categories($args);
if ($categories){
foreach ( $categories as $category ){
if(in_array($category->term_id,(array)$data)) {
$selected = 'checked="checked""';
} else {
$selected = '';
}
echo '<input name="user_cats[]" value="'.$category->term_id.'" '.$selected.' type="checkbox"/> '.$category->name.'<br/>';
}
}
This is what the options look like in the user profile page:
After doing a test save of the some of the checkbox selections, I examined the database value of the "user_cats" field, it gives me something like this:
a:2:{i:0;s:2:"20";i:1;s:3:"343";}
Now, I know what all but one of the variables stand for.
a = Total amount (quantity) of selections
i = Sequential number of the selection (*Starting with 0)
"X" = The number value within the parenthesis is the category ID
My question is, what is the s: value based on? I tried comparing to
string