|
Posted by Captain Paralytic on 02/19/07 12:55
On 19 Feb, 12:40, "2291980" <stephenhb...@gmail.com> wrote:
> Hello
>
> can any body tell me the dff between
> function redirect($url)
> {
> echo "<script>";
> echo "window.location='".$url."'";
> echo "</script>";
>
> }
>
> and
>
> header("Location $url")
>
> syntex belong to php
When a browser sees header("Location whatever-is-the-value-of-$url")
it will barf because it should say header("Location: whatever-is-the-
value-of-$url").
However, supposing that you had put the correct value in the call
then, as soon as it sees the header location value, it can go off to
get the new page. With
function redirect($url)
{
echo "<script>";
echo "window.location='".$url."'";
echo "</script>";
}
it has to load your page before it can see the script to execute.
Navigation:
[Reply to this message]
|