Skip to content Skip to sidebar Skip to footer

Get Localstorage Value Into Php

I have a variable set in localStorage and I want to get it into php. When php is executed the value is already set in local storage, but how should I get into php? I tried somethin

Solution 1:

You can not directly get a localStorage value in PHP, when script is executed, because localStorage is contained in user's browser, and PHP is running on server. However, you can send the value from localStorage to a server with GET or POST request.

Solution 2:

You can't get local storage values from the server. You should use cookies instead. Local storage is client-side only. Cookies are for both. You can get the value with Javascript and then send it to the server in a form or with ajax, or set a cookie with the value and use $_COOKIE to access it.

Post a Comment for "Get Localstorage Value Into Php"