Reputation: 1
Probably something simple I'm missing, but what I'm trying to do is finish up a registration form and after it sends a confirmation email, redirect it to another page. What I have so far
if($sentmail){
<redirection code>
}
else {
echo "Problem sending information, please resubmit.";
}
Upvotes: 0
Views: 58
Reputation: 197775
The most easy redirect call is http_redirect
in PHP. Does everything you need to do for a redirect.
if ($sentmail)
{
http_redirect('new location');
}
else
{
echo "Problem sending information, please resubmit.";
}
Upvotes: 0
Reputation: 11098
You do this by using the header();
function.
if($sentmail){
header("Location: http://mypage.com/redirect.php");
die();
}
else {
echo "Problem sending information, please resubmit.";
}
Use die();
to stop script execution. Though the page redirects, the script still executes.
Upvotes: 0
Reputation: 49208
You want header()
, and possibly an exit
to stop processing.
if ($sentmail) {
header('Location: http://example.com/after_true_statement_redirected');
// exit; ???
} else {
echo "Problem sending information, please resubmit.";
}
Upvotes: 1