Hello,

I know this question was answered many times, and I looked at the answers but still can't find a solution.

I have an index file that includes a contact form.

The contact form action is itself, and if the form succeeds it should redirect to index.php?content=thankyou

Althought the form is being sent successfuly, it does not redirect to index.php?content=thankyou, it tries to go again to itself: index.php?content=contact and I get the "cannot modify header..." error.

I've added ob_start, ob_flush, I checked for spaces after php codes, or anywhere else, nothing helps.

I am attaching the index, contact and the form class files.

The problem might be in the index file line: 56, or on the fgcontactform file line: 143.

I am losing hair here, please, can someone help?

I noticed this

$formproc->RedirectToURL("index.php?content=thankyou");

and some HTML before it (DOCTYPE, html tags, maybe some more).
That might be the problem.

Hi Buppy,

You are a STAR !!!

I moved the code before the DOCTYPE and now my hair starts growing again :)

THANK YOU !