I have an array in my javascript function having string values like 1,2,3,4… etc.
I want to store this array in PHP’s session. I searched it and they say to use JSON but I am getting the way how to use JSON.
Suppose my array’s name is: myArray
and I want to do something like this: $_SESSION[‘myArray’] = myArray;
Is there anyway of doing that? Please provide some working code sample if possible.
Your JavaScript is running on the client, your PHP is running on the server. You need to send the data over HTTP.
To get data from a JavaScript array to a PHP session you need to:
$_POST)$_SESSION