March 16, 2012
Redirect Page after Login
Question by Dom
I have user login page on my site that currently uses the following code to redirect users to this page – index.php
// Redirect to frontpage
header("Location: index.php");
}
But I would like to redirect the user to this page: books.php
books.php?u='.$_SESSION['uid'].'
I tried
header("Location: books.php?u='.$_SESSION['uid'].'");
But that doesn’t work – I assume that I am missing some ‘ or brackets. Can anyone suggest some help.
Answer by Starx
There is a typo error in your code.
header("Location: books.php?u=".$_SESSION['uid']);
// ^ missing matching quote and extra quote at the end
exit(); // As Bazzz said, you should stop the processing after this