Note that there are some explanatory texts on larger screens.

plurals
  1. POstore php multidimensional array in localstorage
    primarykey
    data
    text
    <p>I'm building a site where a user can use the site and input data. However to save their data, they need to log into my site (using facebook connect). The data that they input is stored in a php multidimensional array with the following structure:</p> <pre><code>$order = array(); $order[] = array('rank'=&gt;'1', 'day'=&gt;'Tues'); // This $order[] has input inputted several times by the user // I haven't included all the code because it's big, all that's really needed is to see the structure of $order </code></pre> <p>My question is, how do I convert the php multidimensional array into javascript and then how do I store it onto localStorage using localStorage.setItem() so that once they've logged in with facebook connect I can use that data? Is this the best way of going about it or should I be doing something else?</p> <pre><code>&lt;?php require_once 'src/facebook.php'; $order = array(); $order[] = array('rank'=&gt;$column, 'day'=&gt;$day); $loginUrl = $facebook-&gt;getLoginUrl(array('scope'=&gt;'user_about_me,email')); ?&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function fblogin() { var fk = "&lt;?php echo $loginUrl; ?&gt;"; // What do I do here to convert $order into javascript? // What do I do here to store converted $order onto localStorage() window.location = "&lt;?php echo $loginUrl; ?&gt;"; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;INPUT type="image" src="img/fb.png" onclick="fblogin()" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload