php - header ("Location: URL); Error -


this question has answer here:

the insert works tested without header redirect. problem i'm using mysqli object oriented approach , still new it. when have header redirect in there tells me in browser

"warning: cannot modify header information - headers sent (output started @ /home/hawkwsco/public_html/admin/include/template/doc.inc.php:1) in /home/hawkwsco/public_html/admin/include/library/functions/process/process.inc.php on line 10"

my code below:

<?php require ($_server['document_root'].'/admin/include/config/config.inc.php'); $query = ("insert page(pa_id, pa_page, pa_page_info) values ('null', '{$_post['page']}', '{$_post['info']}')"); $mysqli->query($query); header("location: http://".$_server['server_name']."/admin/content.php"); exit; ?> 

what doing wrong?

most file including has text in being output (even newline @ end of file enough) causing output start before header can sent. make sure includes not have ?> @ end avoid problem.

alternatively, can use output buffering (ob_start()) avoid output being sent until ready. ob_start() must called before output effective.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -