Hello,
I'm updating an existing application which contains a lot of scripts to do forwording to other pages,
like this for example
}else{
echo "<script>window.location=\"login.php\"</script>";
Do we have a clean php solution for this matter, cause this is not a very beatifull solution.. or is this the way to do it ?
php forwarding
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
If the forward is done in the middle of a page and for whatever reason can't be calculated before output starts, that's the way to do it. However, all the logic should be done prior to any output starting in an ideal world.
Using header('Location: someFullURL') in combination with outputting a <meta> redirection tag (and a brief description of what's happening) in case the users' browser doesn't support header level redirection is the preferred and recommended solution.
Using header('Location: someFullURL') in combination with outputting a <meta> redirection tag (and a brief description of what's happening) in case the users' browser doesn't support header level redirection is the preferred and recommended solution.