array storing
-
iam tring to store an array using wp-sessions.my code shown below.
if(isset($_POST['id'])) { $wp_session = WP_Session::get_instance(); if(isset($wp_session['ym_cart'])) { $wp_session['ym_cart'][]=$_POST['id']; } else { $wp_session['ym_cart']= array(); $wp_session['ym_cart'][]=$_POST['id']; } print_r($wp_session['ym_cart']); }
‘ID’ is coming from an ajax form submission.Error is array storing only one value.How can i push values to these array ?
- The topic ‘array storing’ is closed to new replies.