PDA

View Full Version : Redirection in PHP



martystudio
December 23rd, 2002, 10:57 AM
I have this code



if (is_null($_POST['name']) == TRUE) {
header("Location: http://www.martystudio.com/index.php?error=101&from=home");
}
print $name;

it works fine, but when iit is supposed to redirect it wont, i need to find out why and find the script that works:

Note, for some reason the link looks funny when im posting

Edited by h88 - fixed code

h88
December 24th, 2002, 11:32 AM
Are you using GET or POST to post your variables?

The code is working fine...

IceCube
December 25th, 2002, 02:41 PM
you might be wanting to use output buffering too when redirecting.
ob_start()
ob_end_clean()
ob_end_flush()

that is so you wont be getting any errors about headers already sent