亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Setting session variables using JavaScript in PHP
P粉515066518
P粉515066518 2023-08-22 00:46:44
0
2
523
<p>Is it possible to set PHP session variables using Javascript? </p>
P粉515066518
P粉515066518

reply all(2)
P粉475315142

Sessions are stored server-side, so you cannot add values ??to them from JavaScript. On the client side you can only get the session cookie, which contains an id. One possibility is to send an AJAX request to a server-side script, which will set the session variables. Here is an example using jQuery's .post() method:

$.post('/setsessionvariable.php', { name: 'value' });

Of course, you should be careful about exposing such scripts.

P粉587780103

In JavaScript:

jQuery('#div_session_write').load('session_write.php?session_name=new_value');

In the session_write.php file:

<?
session_start();

if (isset($_GET['session_name'])) {$_SESSION['session_name'] = $_GET['session_name'];}
?>

In HTML:

<div id='div_session_write'> </div>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template