Reputation: 175
I am trying to redirect to some page after php processing. Sometimes it works fine and it redirects to the next page but 50% of the time it just reloads the same page again.
I have tried different things like ob_clean(), ob_flush() before redirecting but it didnot work
function util_redirect ($page)
{
ob_start();
header("Location: " . $page,true,302);
ob_end_flush();
die(1);
}
Expected: redirects to the next page Actual: Reloads current page instead
Upvotes: 1
Views: 50
Reputation: 402
Try this and I think this will work
function util_redirect ($page){
header('Location: '.$page, TRUE, 302);
}
Upvotes: 1
Reputation: 1
I think you can achieve it this way without complexity or 50% error
function util_redirect ($page){
header("Location: " . $page);
}
Upvotes: 0