A
A
alpa_kz2017-03-10 15:24:22
PHP
alpa_kz, 2017-03-10 15:24:22

Is it possible to process a session created with Javascript in PHP?

d455d372015e4750852c001ef8ae3ab9.png
In the developer tools, you can see that the session was created in the form:
[[{"name":"Product name","type":"title","value":"URSA GEO Light (16.8m2)"},{"name" :"Product price","type":"price","value":"4809 ."},{"name":"Product photo","type":"photo","value":"//u8 .platformalp.ru/54c96e888917c37ce9b0f13b49f309f8/16d9688f98006f96a929b5ef700ac811.png"},{"name":"Amount","type":"amount","value":1}],[{"name":"Product name"," type":"title","value":"URSA GEO Mini"},{"name":"Product price","type":"price","value":"40000 ."},{"name":"Product photo","type":"photo","value":"//u8.platformalp.ru/54c96e888917c37ce9b0f13b49f309f8/c1b772dde8b226afb85526fbd8aaed18.png"},{"name":" Amount","type":"amount","value":1}]]
but can't handle it in PHP
@session_start();
$array_session = json_decode($_SESSION['cart'],true);
echo " $array_session['cart'][0][0]['name']";
echo " $array_session['cart'][0]['name']";
come out empty what is the problem I can not understand?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
U
Urvin, 2017-03-10
@alpa_kz

SessionStorage is a session on the frontend and does not overlap with a PHP session on the backend: Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server.
Use, for example, AJAX to exchange information between the front and backend.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question