lukeurtnowski — 2012-10-29T18:01:28-04:00 — #1
After my contact form is filled out why is my redirection code,
Warning: Cannot modify header information - headers already sent by (output started at /home/fixmy1/public_html/masterasp/contact.php:13) in[B]/home/fixmy1/public_html/masterasp/contact.php on line 42[/B]
cpradio — 2012-10-29T18:27:01-04:00 — #2
because you have already sent output to the page, you can't have any output on the page prior to your header() statement. So no echo, print, or text outside of php tags.
lukeurtnowski — 2012-10-29T19:10:04-04:00 — #3
so, the only way I can use that statement is if its the first thing on my page?
cpradio — 2012-10-29T19:35:59-04:00 — #4
the only way you can use header() and setcookie (for that matter) is if you have not started any output yet. You can have other PHP code above it, validation, emailing the form contents, writing/reading to a database, etc, but you can't have output.
cpradio — 2012-10-29T19:37:10-04:00 — #5
Think of it this way:
header() is a command to the browser to tell it to redirect to somewhere else. If you have output, the browser will begin its render process and won't acknowledge any commands, because it is past that stage and in the stage of drawing the output to the page for the user to see.