The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Well, the error message is quite useful here - it tells you that you cannot post headers, because something else was already posted.

The header you're trying to send (Location: ...) is a HTTP header and as such must be the first thing to be output by your script. Obviously, this is not the case, since you're already outputing some html before.

You could move that header code before that html, this would be the easy way.

Well, the error message is quite useful here - it tells you that you cannot post headers, because something else was already posted.

The header you're trying to send (Location: ...) is a HTTP header and as such must be the first thing to be output by your script. Obviously, this is not the case, since you're already outputing some html before.

You could move that header code before that html, this would be the easy way.

Or you can add ob_start() as the first line in the script and use PHP's output buffering to avoid having to move the header code. This also takes care of any other header errors. Also add exit() after the header declarations. HTH

This is all my php script from contact_form1 followed (not-posted) by the usual html code with the input tags for my contact form.
I don't have any html wich is sendind the page to thankyou.html.
Can you plase have a look and tell me where I've made a mistake?
Thank you again.

This is a completely different problem. The first one that you described was caused by the html code in line 14 of file contact_us.php, so you actually _did_ have some html code output before the headers.

In this code you posted, you're including a file called contactform1.php, which probably has some html code in it? That html is sent to the browser before your header() call is made. Mandibal and I told you how to solve this.

About this last error, not sure what causes it, it looks like some syntax error, but I cannot say more until I see your code. The one posted in your previous post looks ok, did you change anything?

I've put the semicolon after ob_start [ ex: ob_start () { ] and I've close it
before exit() and I have the following error now
Parse error: parse error, unexpected '{' in C:\Program Files\Apache Group\Apache2\test\dabisolutions\site\contact_form1.php on line 2.

There is any other way to redirect my contact form after submitting to my thank you page?

I've put the semicolon after ob_start [ ex: ob_start () { ] and I've close it
before exit() and I have the following error now
Parse error: parse error, unexpected '{' in C:\Program Files\Apache Group\Apache2\test\dabisolutions\site\contact_form1.php on line 2.

There is any other way to redirect my contact form after submitting to my thank you page?

As dbevfat mentioned these errors are syntax errors. Missing semi-colons or { or } etc. Trying to find different solutions because your getting syntax errors is not very productive. Check around line 2 in contact_form1.php for syntax errors.

Last edited by Mandibal; Apr 28, 2005 at 05:38.
Reason: Read spikz post and realized that I misread the error and what catalin said.

If the code above is contact_form1.php, why are you using a require() if the contents of contact_form1.php include your mysql_pconnect() then fine, use require but there really shouldn't be much else in it.

(you can't include the file you are using in the the file you are using!!!)

Cheers

SpikeZ

Mike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\test\dabisolutions\site\contact_us.php:14) in C:\Program Files\Apache Group\Apache2\test\dabisolutions\site\contact_form1.php on line 55

When something suddenly occurred to me.....
There is nothing wrong with the code you posted in post#9, the problem is on contact_us.php line 14. Could you be a darling and post the contact us page code!

Cheers

SpikeZ

Mike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....

This is my contact_us page.
I think I've seen the problem.
I've highlighted the php code in this file and I dont think is in the right position but if I'm going to change that all in my page will be messed up.

The problem as you rightly say is that the form is being included way down the page.
Here's what you can do....

1./ on your page with the form, cut the form out of the coding leaving all the php above alone,
2./ paste the form into the above contact_us page. so now you have the form on the page and change the form action to contact_form1.php (the page with the code still on it)
3./ sit back and relax!

SpikeZ

Mike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....