Forum Moderators: coopster

Message Too Old, No Replies

header() redirect is failing

         

stepheng

12:09 am on May 5, 2010 (gmt 0)

10+ Year Member



Hey everyone,
For some reason I can't get a header() redirect to work at the bottom of a script. It works for me in every other script I have except this one.
I am outputting absolutely nothing to the browser before the header() redirect. If I replace the header() redirect with a generic echo, the echo will print.
At the top of the script I am calling the below scripts:

 require_once('../../config.php');
require_once(''.$path_to_includes.'config/config.php');
require_once(''.$path_to_includes.'config/dbconnector.php');
require_once(''.$staff_root_path.'auth.php');
require_once('invoice.functions.php');


And here is the code I am using for my header() redirect:

header('Location: '.$staff_root_http.'invoices/'.$invoice_new.'/'); /* Redirect browser */
exit;


I can not think of any reason that this would be failing. What are some possible reasons this might fail?

rocknbil

1:55 am on May 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you missing a slash, or is it part of $staff_root_http?

header('Location: '.$staff_root_http.'/invoices/'.$invoice_new.'/');

stepheng

3:08 am on May 5, 2010 (gmt 0)

10+ Year Member



Rocknbil, the slash is part of $staff_root_http. But I've actually just figured it out. I unfortunately had error_reporting off and was using an undeclared variable.

Thanks though.