I have a PHP script that sending an email after the user click the submit button and it will redirect also to another page. But the header('location: ');
is not working. I already remove the whitespace before <?php
and after ?>
How to fix this?
I have a PHP script that sending an email after the user click the submit button and it will redirect also to another page. But the header('location: ');
is not working. I already remove the whitespace before <?php
and after ?>
How to fix this?
The redirect in the original version of your question was incorrect. The location provided to the Location
header needs to be a full url. When you say:
header('Location: website.com');
the browser interprets that as a redirect to a website.com
file on your website. Instead, you will need to provide the full url, like this:
header('Location: http://website.com');
Additionally, in the error you are getting,
Warning: Cannot modify header information - headers already sent by (output started at .../class.wp-styles.php:127) in .../_resumeForm.php on line 248
is an indication that you've already started to output content to the browser. You can not set headers after you have already started to output content. class.wp-styles.php:127
is the location in the code that actually output content, but most likely you are calling that code (directly or indirectly) from somewhere else.
In order to fix the error, you will have to figure out where the output is being started, and stop it from happening there. For more suggestions on just how to do that, see the answer to the question that this one has been marked a duplicate of.