[RESOLVED] PHP: Header Code Not Work When Website is Uploaded
Hi guys.
I get this error:
Quote:
Warning: Cannot modify header information - headers already sent by (output started at /home/janrapha/public_html/UpdateToday/includes/overall/header.php:7) in /home/janrapha/public_html/UpdateToday/register.php on line 116
line 116 is this code.
Code:
header('location: register.php?success');
I got no error when I'm running the site in my localhost. But when I upload the files online, I got errors saying headers are already sent.
Please help.
Re: PHP: Header Code Not Work When Website is Uploaded
I've decided to replace the php code:
Code:
header('location: register.php?success');
with a javascript code:
Code:
<script type="text/javascript">
<!--
window.location = "http://www.google.com/"
//-->
</script>
Problem solve
Re: [RESOLVED] PHP: Header Code Not Work When Website is Uploaded
You are supposed to use the header function before echoing anything on the page. Means it should be used before the output.
Quote:
Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
Read more in here: http://php.net/manual/en/function.header.php
:wave: