/    Sign up×
Community /Pin to ProfileBookmark

Store variable into SESSION using Javascript ?

Hi all,

I`m wondering if I could store a variable into a SESSION using Javascript…

Here`s what I want to do… I want to get the user pc`s time and store it into a variable within a session.. this would look like this :

var time= getTime();

$_SESSION[‘usertime’] = time;

…..
Sorry for the bad code but I`m a total noob with Javascript and now I`m focusing on PHP and C++ …. 🙂

can anyone please help me out ? ? I want to access that session varibale afterwards to get the users`s time and use it in a PHP script 🙂

Thanks a lot 🙂 Cheers !

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jan 14.2008 — You would have to post the data to the server. Once the poage is rendered, you have no access to the server.

Eric
Copy linkTweet thisAlerts:
@cgishackJan 14.2008 — you can always use a cookie.

but if your sever side code is using session variables, post it back like A1ien said.

Drew
×

Success!

Help @serik16 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...