Creating a session with Javascript that can be read by PHP?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Creating a session with Javascript that can be read by PHP?

Post by robster »

Hi all, I have a session, this is an example of the content this session could contain:

Code: Select all

$_SESSION['nav']['client_id'] = "1"; //Make the first client they see client #1
$clientid = $_SESSION['nav']['client_id'];
So you get the idea, with PHP that is how I would stick the contents into $clientid.


How can I get this with javascript though? How can I create a session in a javascript script I've written that can then be read by the PHP script later down the track with the code $clientid = $_SESSION['nav']['client_id'];

Can it be done at all?

All advice appreciated,

Rob
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

User avatar
robster
Forum Contributor
Posts: 360
Joined: Wed Jul 16, 2003 8:28 am
Location: Sunshine Coast, Australia

Post by robster »

thanks,

It says that you can create a session cookie but you cannot manipulate any of the variables associated with one from within Javascript directly.

That means I cannot do what I want to do correct?

Or have I misread this (shrug)?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

robster wrote:That means I cannot do what I want to do correct?
bingo.
Post Reply