sandy.wilkins.cr Posted December 2, 2008 Share Posted December 2, 2008 Hello everyone! I've searched the forum and there are other similar questions, but no good answers... ... so here goes: I have an html file that uses ajax (javascript) for login validation. This internally calls login.php which checks the database to see if the username and password are correct. What I'm doing is that login.php returns a 1 if the login is ok and 0 if its not. The javascript file reads this and if its a 1, redirects the user to the welcome page: window.location="./welcome.php?"; If the login data is correct, I want to set some session variables in that file, which I want to be able to read in the welcome page. session_start(), which I call in login.php seems to work ok, but I cannot set the session variables there. Any ideas? I can post code if needed. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/135224-help-with-setting-session-variables-in-an-ajax-function/ Share on other sites More sharing options...
corbin Posted December 2, 2008 Share Posted December 2, 2008 Post code please, because there's no reason that shouldn't work. Quote Link to comment https://forums.phpfreaks.com/topic/135224-help-with-setting-session-variables-in-an-ajax-function/#findComment-704397 Share on other sites More sharing options...
sandy.wilkins.cr Posted December 2, 2008 Author Share Posted December 2, 2008 Ah ok, I just found my mistake. I did not include session_start(); on welcome.php, only on login.php. It has to be everywhere $_SESSION is used. Thanks.. at least I hope this helps someone else. Quote Link to comment https://forums.phpfreaks.com/topic/135224-help-with-setting-session-variables-in-an-ajax-function/#findComment-704419 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.