Ajax save to session, then use cookies on new page not working

I am retrieving some log in details from a web service, and once collected i need to save these values to session cookies, and then use them to verify a user and then on a form.

But it seems that i can post the values to the page, but the values seems to clear before i can use them

So I have this in ajax.

function onDataReceived(data)
if (data != 0){
var stuff = data;
var split = stuff.split("/");
type: "POST",
data: {ID: split[0], EMAIL: email, NAME: split[1], COMPANY: split[2]},
success:function() {


$_SESSION["user"] = isset($_POST['ID']) ? $_POST['ID'] : '';
$_SESSION["email"] = isset($_POST['EMAIL']) ? $_POST['EMAIL'] : '';
$_SESSION["name"] = isset($_POST['NAME']) ? $_POST['NAME'] : '';
$_SESSION["company"] = isset($_POST['COMPANY']) ? $_POST['COMPANY'] : '';

Then on the page I need them I have this, but when I echo them out there nothing there.




echo ($userID." - ID; ");
echo ($userEmail." - email; ");
echo ($userName." - name; ");
echo ($userCompany." - company; ");

Droopsnoot in the php forum has suggested that when iā€™m posting the values onto the php page, that once that session is done it closes the session down and so clears the cookies, i agree but the trouble is i dont know how to get around it, as these values are quite critical to the site

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.