This question already has an answer here:
<html>
<body>
<?php
error_reporting(E_ALL | E_WARNING | E_NOTICE);
ini_set('display_errors', TRUE);
if( $_SERVER['REQUEST_METHOD'] == 'POST') {
header('Location: https://www.google.com/', true, 302);
exit();
}
?>
<form method='post'>
<input type='submit' name='submit' value='Submit' /><br />
</form>
</body>
</html>
The form works as expected if the "html" and "body" tags are removed. The presence of either one of them causes failure. This occurs on one hosting site; however I can run it on another host without any problems.
Are there any settings in php.ini that could cause this behavior?
When the code runs with the "html" or "body" tags, this error is displayed: Warning: Cannot modify header information - headers already sent by (output started at /webroot/m/o/montc001/primary/www/test.php:3) in /webroot/m/o/montc001/primary/www/test.php on line 7
The site that fails, also has Wordpress installed. The WP site is being replaced by a new implementation.
</div>