Many thanks in advance for even attempting to present a solution.
I’m having trouble with a simple html contact form.
The form’s method is set to post and it’s action is sent to a php file.
At the end of the PHP file the form is sent to, there is a basic location:redirection.
ex) header("Location: ../index.htm");
I configured my php.ini file (Apache) to display the php error(s).
This is what I’m shown:
"Cannot modify header information - headers already sent by (output started at /home2/jwarddes/public_html/newTest/php/contact.php:2) in /home2/jwarddes/public_html/newTest/php/contact.php on line 20"
Line 20 of my code is my header("location:... redirect. This appears to be fine, yet something keeps throwing an error.
Needless to say, I’m stumped.
Could someone please try their hand at a solution or kindly nudge me in the right direction?
Thanks!
that is a common problem.
make sure you do not have any output (even a simple space at the top of the page) as that will send the headers prior to your redirect.
Possible Solutions are the following.
in the top of your page and
at the bottom might solve your issue.
Also, I have this special function below which do a very smart redirect, try it out and let me know 🙂