Page 1 of 1

header redirect not sending the variable

Posted: Wed Mar 08, 2006 2:58 pm
by bordman
Hi,
I have a page (contact_us.php) which submits to contact_us_process.php
After some form validation on contact_us_process.php, I have the following code:

Code: Select all

$fileErrorPage = 'contact_us_result.php?result=error';

 header('Location: $fileErrorPage');
 exit;
I get the following error:
The error page: http://www.mydomain.com/contact_us_resu ... sult=error cannot be found on the server.

The url in the address bar is still:
http://www.mydomain.com/contact_us_process.php

Any ideas why?

Thanks!

Re: header redirect not sending the variable

Posted: Wed Mar 08, 2006 3:19 pm
by Buddha443556
bordman wrote:

Code: Select all

$fileErrorPage = 'contact_us_result.php?result=error';

 header('Location: $fileErrorPage');
 exit;
I'm surprise that even works at all with single quotes in the header() statement.

Posted: Wed Mar 08, 2006 3:30 pm
by bordman
Yes it works like that...I tried this too:

Code: Select all

header("Location: $fileErrorPage");
and that does the same thing...but that's not the problem...

Posted: Wed Mar 08, 2006 3:55 pm
by Buddha443556
Might try an absolute address which is required by HTTP 1.1.

Code: Select all

$fileErrorPage = 'http://'.$_SERVER['SERVER_NAME'].'/contact_us_result.php?result=error';