james
james

Reputation: 11

php sessions using ajax

hi im trying to write an enquiry form in php where it gets values from a session array.. but ive cant think how to start.. what im thinking is say for example ive got a page with items on and i click add to enquiry list it will then post it to the enquiry page using ajax? can anyone give me a push start?

cheers

Upvotes: 1

Views: 257

Answers (1)

Hamdi
Hamdi

Reputation: 41

You shall pass sessions variables to your AJAX requests in the form of (javascript code):

enquiry.php?' + session_name + '='  + session_id + '&add=whaevere_you_want&foo=bar

Where session_name and session_id are javascript local variables obtained via AJAX initalizer to fetch them from a php script which is capable of providing them via PHP functions:

session_name()
session_id()

respectively

Upvotes: 1

Related Questions