Am I using header function incorrectly?
I'm using this header('Location:index.php'); to get my page reload after user press the submit button.
It's working like a charm, but if you take a look at the PHP manual there is: "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".
$comment = $_POST['comment'];
$writer = $_POST['writer'];
$date_and_time = date('Y-m-d H:i:s');
mysql_query("INSERT INTO comment (writer, comment, date_and_time)
VALUES ('$writer', '$comment', '$date_and_time')")
So am I doing something very wrong or not ?
no you are doing all fair as there is no output before header(); function at all.
At top file
add <?php ob_start(); ?>
and check it now
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)