I have several fruit checkboxes but when saving to the wpdb database it only saves the last one that it checks, variable $check receives vardump string (6) "banana" string (5) "apple"
In the database only appears apple should be banana, apple in that same field an array. Should not only save it the last marked
foreach( $checkboxes as $check ) { var_dump( $check); } global $wpdb; $wpdb->insert('data',array( 'fruit' => $check ));
$checkboxes
, not$check
, which can only be one item because it's created in theforeach
loop.