header redirect not sending the variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bordman
Forum Newbie
Posts: 16
Joined: Thu Jan 26, 2006 8:20 am
Location: RI

header redirect not sending the variable

Post 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!
Last edited by bordman on Wed Mar 08, 2006 3:25 pm, edited 1 time in total.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Re: header redirect not sending the variable

Post 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.
bordman
Forum Newbie
Posts: 16
Joined: Thu Jan 26, 2006 8:20 am
Location: RI

Post 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...
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post 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';
Post Reply