Page 1 of 1

header function not working

Posted: Thu Aug 04, 2011 10:29 am
by n3wb1e
Good day,

I have this piece of code which validates a captcha image. When I uncomment the 'echo' portion, the function works, but all the page does is give me a success message. When I try the header redirect, the page simply comes up blank and doesnt redirect anywhere, or do anything. Can anyone tell me why this is?

---------start code-------------
if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
header('Location:http://www.google.com');
//echo "The security code entered was correct.<br /><br />";
}
-------------end code-------------------

Thank you.

Re: header function not working

Posted: Thu Aug 04, 2011 11:15 am
by twinedev
You have commented out the start of the echo statement, but not the rest of it, so when it encounters the line:

Code: Select all

";
it crashes out.