here is the entire thread
From: "Kimmo Laine" <eternal.erecti onN0.5P@Mgmail. com>
Subject: Re: script in body
Date: Mon, 20 Jun 2005 17:46:28 +0300
Message-ID: <d96klv$8vi$1@p hys-news1.kolumbus. fi>
Lines: 64
"Sentinel" <support@elma.h r> kirjoitti
viestissä:d95r6 k$36p$2@ss405.t-com.hr...[color=blue]
> Kimmo Laine 17.6.2005 19:27:59 <d8v11i$ot7$1@p hys-news1.kolumbus. fi>
> eternal.erectio nN0.5P@Mgmail.c om comp.lang.javas cript Kimmo
>[color=green]
>> "Sentinel" <support@elma.h r> kirjoitti
>> viestissä:d8u71 d$e98$1@ss405.t-com.hr...[color=darkred]
>> > how can i place a script in body (it must be ran automaticly when
>> > html interpreter reaches it) that will redirect to another page?
>> >
>> >
>> > what i am doing is
>> >
>> > checking in php if login is successful (php script is in javascript
>> > that is in body) and if so i will print out the url to wich the
>> > javascript must redirect the browser
>> >
>> >
>> > <body>
>> > <script language="javas cript">
>> > window.location =<?php a lots of ifs thens and elses and finaly[/color][/color][/color]
print[color=blue][color=green][color=darkred]
>> > "index2.php "; ?>
>> > </script>
>> > </body>
>> >
>> >
>> >
>> > everything works fine but he browser doesn't redirect...
>> >
>> > the page source shows
>> > <body>
>> > <script language="javas cript">
>> > window.location =index2.php
>> > </script>
>> > </body>[/color]
>>
>> Ditch the javascript and redirect with php directly
>> <?php header("Locatio n: index2.php"); ?>[/color]
>
> can i send any data to the child page this way?[/color]
Yes, via GET method.
<?php header("Locatio n: index2.php?foo= 1&bar=2"); ?>
Parameters foo and bar are now available to index2.php. Oh and I
should
mention also, that the example I gave you works in most browsers, but
the
standard says you need to always always include the entire address, and
not
just the relative filename. In other words: always use
<?php header("Locatio n:
http://www.your-domain.com/path/to/index2.php"); ?>
and never ever use
<?php header("Locatio n: index2.php"); ?> without the entire url.
I should also mention that header data must be sent before any output.
You
can't print or echo anything before you've sent headers.
Copy & Follow-up to: comp.lang.php
what i need is the ability to write something to the user and then
redirect him or her to index2 or index
--
What's the point in running when the light at the end of the tunnel iz
just another train...
From: "Kimmo Laine" <eternal.erecti onN0.5P@Mgmail. com>
Subject: Re: script in body
Date: Mon, 20 Jun 2005 17:46:28 +0300
Message-ID: <d96klv$8vi$1@p hys-news1.kolumbus. fi>
Lines: 64
"Sentinel" <support@elma.h r> kirjoitti
viestissä:d95r6 k$36p$2@ss405.t-com.hr...[color=blue]
> Kimmo Laine 17.6.2005 19:27:59 <d8v11i$ot7$1@p hys-news1.kolumbus. fi>
> eternal.erectio nN0.5P@Mgmail.c om comp.lang.javas cript Kimmo
>[color=green]
>> "Sentinel" <support@elma.h r> kirjoitti
>> viestissä:d8u71 d$e98$1@ss405.t-com.hr...[color=darkred]
>> > how can i place a script in body (it must be ran automaticly when
>> > html interpreter reaches it) that will redirect to another page?
>> >
>> >
>> > what i am doing is
>> >
>> > checking in php if login is successful (php script is in javascript
>> > that is in body) and if so i will print out the url to wich the
>> > javascript must redirect the browser
>> >
>> >
>> > <body>
>> > <script language="javas cript">
>> > window.location =<?php a lots of ifs thens and elses and finaly[/color][/color][/color]
print[color=blue][color=green][color=darkred]
>> > "index2.php "; ?>
>> > </script>
>> > </body>
>> >
>> >
>> >
>> > everything works fine but he browser doesn't redirect...
>> >
>> > the page source shows
>> > <body>
>> > <script language="javas cript">
>> > window.location =index2.php
>> > </script>
>> > </body>[/color]
>>
>> Ditch the javascript and redirect with php directly
>> <?php header("Locatio n: index2.php"); ?>[/color]
>
> can i send any data to the child page this way?[/color]
Yes, via GET method.
<?php header("Locatio n: index2.php?foo= 1&bar=2"); ?>
Parameters foo and bar are now available to index2.php. Oh and I
should
mention also, that the example I gave you works in most browsers, but
the
standard says you need to always always include the entire address, and
not
just the relative filename. In other words: always use
<?php header("Locatio n:
http://www.your-domain.com/path/to/index2.php"); ?>
and never ever use
<?php header("Locatio n: index2.php"); ?> without the entire url.
I should also mention that header data must be sent before any output.
You
can't print or echo anything before you've sent headers.
Copy & Follow-up to: comp.lang.php
what i need is the ability to write something to the user and then
redirect him or her to index2 or index
--
What's the point in running when the light at the end of the tunnel iz
just another train...
Comment