Posted by Jerry Stuckle on 12/17/22 11:56
paullefil wrote:
> I have 3 files on my website
>
> tes1.php :
> <?php
> require_once("test2.php");
>
> if ($_GET['redirige'] == 1)
> {
> @header( "Location: http://www.mydomain.com/test3.php" );
> }
> else
> {
> echo "it's test1.php";
> }
> ?>
>
> and test2.php (one file without php code !)
>
> <?php
> ?>
>
> and test3.php :
>
> <?php
> print "it's test3.php";
> ?>
>
> Now if you load :
> http://www.mydomain.com/test1.php
> (it's written "it's test1.php")
>
> Now if you load :
> http://www.mydomain.com/test1.php?redirige=1
>
> The result is a blank page but normally you will be redirect to
> http://www.mydomain.com/test3.php with "it's test3.php" written.
>
> Now in the test1.php file, you delete the ligne
> require_once("test2.php");
> So your test1.php file is :
>
> <?php
> if ($_GET['redirige'] == 1)
> {
> @header( "Location: http://www.mydomain.com/test3.php" );
> }
> else
> {
> echo "on affiche test1.php";
> }
> ?>
>
> Now if you load :
> http://www.mydomain.com/test1.php
> (it's written "it's test1.php")
>
> Now if you load :
> http://www.mydomain.com/test1.php?redirige=1
>
> The result is a OK you are redirect to
> http://www.mydomain.com/test3.php with "it's test3.phpp" written.
>
> Could you help me, where is the bug ?
>
> SBE
>
You've got white space before or after your php code in test2.php.
If you were displaying errors, you'd get a message about the headers
already being sent due to this white space.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|