ngreenwood6 Posted October 6, 2008 Share Posted October 6, 2008 I have alot of code so I am not going to post it because it seems like no one helps if you do. I have a pretty simple question though. I have a form that onlick it posts the username and password to a page called check_user.php. If the username and password are correct it instead posts it to process_login.php. When it goes to process_login.php it registers their username in the session and redirects to main.php. The problem is that I do not know how to get it to process process_login.php and do what it tells it to do. It just stays on the login page when it is supposed to be redirect to the main.php page. My process_login.php page looks like this: <?php //include the variables include("includes/variables.php"); //get the username from the form $username = strtolower($_POST['username']); if($username != "") { $_SESSION['username'] = $username; header("Location: main.php"); } ?> How do I get it to go to the main.php page with ajax? It seems like all it does is check this page and not actually do what it says. Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted October 6, 2008 Author Share Posted October 6, 2008 This should be pretty simple. Basically all I want is for the ajax to allow the php to do what it wants to do. It needs to redirect to main.php. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 6, 2008 Share Posted October 6, 2008 Nothing you're doing here is AJAX. It is all just PHP. The code you listed will redirect to main.php if the $username variable is not blank. Is that your intention? Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted October 6, 2008 Author Share Posted October 6, 2008 I have an ajax function posting to that page. It didnt work but I have gone about it in a different manner now and it is working I just need to find out the code to redirect using ajax. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted October 6, 2008 Share Posted October 6, 2008 OK, you may be using AJAX on your site, but you're not asking AJAX questions, nor are you posting AJAX code. Again, were my assumptions about what you're trying to do correct? If they are, what happens when you echo your $username variable? I'm thinking that your $_POST variable isn't being passed to this page. Quote Link to comment 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.