header function not working

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
n3wb1e
Forum Newbie
Posts: 3
Joined: Thu Aug 04, 2011 10:14 am

header function not working

Post 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.
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: header function not working

Post 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.
Post Reply