Jump to content

how to change value of a php session variable in javascript


sunil.23143

Recommended Posts

PHP is a server side script, all variables are set at the server before being given over the the client

 

Javascript is a client side script working with what it has been given

 

to change a php variable and maintain it as a php variable then php server side has to do the change, hence you would have to pass it back to php, allow it to make the change and then pass it back to the client

 

so in other words javascript cannot change the value of a php variable

Link to comment
Share on other sites

It can... Using AJAX and a script on a server side, at least session variables could be modified this way.

 

True, but what paul2463 says is still true: JavaScript cannot change the session variable. It can submit the request and provide the value to another script, but it will still require a PHP (or other server side) script to do the data manipulation ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.