Click here to Skip to main content
13,047,131 members (59,951 online)
Rate this:
Please Sign up or sign in to vote.
See more:
hi all.

im trying to do the following :
a simple login page, asking the user for user/pass . verify that user exist in db and then, write the username to a session varm and then .
redirect him/her to another page that acts a small business online store .

what happens now, is that the user can purchase an item using paypal procedure, that redirects to a quick paypal secure check out page (payment page).

when payment is complete, i get a notification to a listener script on my server, that captures the payment status (and some other stuff....) and then runs another procedure that write all the relevant details to my db .

now, what im trying to do, is use the session var 'username' i saved in the 1st stage, and add it to the data i'm writing to the db .
except, when i run that cmd in the script, the session var holds no value .

i guess im not that educated on sessions. can anybody here plese give me a clue ?

Posted 12-May-12 7:22am
Mohibur Rashid 13-May-12 8:01am
you must have to use session_start function in the beginning of every page. and indexes are case sensitive

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In php you start a session using:

To store a variable you use:
$_SESSION['var'] = "your value here";

To read from that variable in another page or even the same page use the same command minus the equals sign forward.
Then finally to terminate the session use:

Make sure not to terminate the session until your done reading the data because when you terminate the session it wipes the values.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 14 May 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100