Gossamer Forum
Quote Reply
PHP error
I have created a mail form which works but doesn't like the redirect to thanks.php. Could someone help me debug this please. Thanks

Error msg I get

Warning: Cannot add header information - headers already sent by (output started at /home/www/ourfuturetogether/forms/contact.php:2) in /home/www/ourfuturetogether/forms/contact.php on line 44



Line 44 code = header('Location: thanks.php');

If I change the code to echo then it does print without any complains but I need it to redirect it to the thank you page I have created.

any help would be appreciated. Thanks
Quote Reply
Re: [shaan] PHP error In reply to
It looks like you are printing two headers. Could you post more of the code?
Quote Reply
Re: [Paul] PHP error In reply to
thanks, I have uploaded the file.
Quote Reply
Re: [shaan] PHP error In reply to
What about using double quotes, instead of single?

Code:
header("Location: thanks.php");

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] PHP error In reply to
tried that too! What is really interesting is that

the same code works very well on 1 server but it does not on a 2nd server which is my live server!

Any ideas what else I can use? I have replaced the header code with "echo" and am trying to get it to print the page but even that doesn't work. All it does is, it checks to make sure all info is available then it sends me the mail - then it clears the form but it does not spit out thanks. It gives you the feeling that it didn't work but the form works except for that stupid thanks page.

attaching an updated code. fresh eyes always do wonders.
Quote Reply
Re: [shaan] PHP error In reply to
How about creating a new subroutine. Try the attached file... I've changed it to call a new routine, where you can define the thank-you HTML there.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [shaan] PHP error In reply to
I notice that there is an extra linefeed at the top. How about making sure that "<?" is flush to the very top line?
Quote Reply
Re: [Aki] PHP error In reply to
AKI YOU ARE A GEM! It works!!!!

I can't believe spent an entire day on one single oversight!

THANKS!!!!

Now ... off to sending BCC - just not working! Will play with it a wee bit more



BUT THANKS! That thing now works!!!

see it in action here

http://www.ourfuturetogether.com/
Quote Reply
Re: [shaan] PHP error In reply to
I should have known that. I remember installing a bulletin board for a client a year or so ago when I experienced the same problem. A year is a long time though and my memory isn't too great :)
Quote Reply
Re: [Paul] PHP error In reply to
THANKS EVERYONE for your help. It's amazing how long such a simple error can take to be fixed!

I would have been lost without you experienced coders. You guys are God sent for us newbies.
Quote Reply
Re: [shaan] PHP error In reply to
I'll have to remember that happens when you are trying to print something in the future. Its not a problem I have had before, but I very much doubt I will 'never' have it Wink A learnming experience for everyone...lol

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!