This question already has an answer here:
Going to call mail within PHP server code then return back to HTML page. Wrote the following server code:
<!DOCTYPE HTML>
<HEAD>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
</HEAD>
<BODY>
<?php
$referer = filter_input(INPUT_SERVER, 'HTTP_REFERER'); // real referrer detected
// do something or nothing
header("Location: $referer");
?>
</BODY>
This code produce an error "Warning: Cannot modify header information - headers already sent by...". Why?
</div>