About header error in PHP -


i working on php project trying redirect 1 page another, using header (location:something.php). it's working fine on local machine when uploaded server, following error occurs:

warning: cannot modify header information - headers sent (output started @ /homepages/4/d404449574/htdocs/yellowandred_in/newtest/edithome.php:15) in /homepages/4/d404449574/htdocs/yellowandred_in/newtest/edithome.php on line 43 

i tried include, include_once, require , require_once it's giving other errors like:

cannot redeclare logged_in() (previously declared in c:\wamp\www\ynrnewversion-1\edithome.php:3) in c:\wamp\www\ynrnewversion-1\adminindex.php on line 5 

my code

<?php session_start(); function logged_in() {   return isset($_session['username']); }  function confirm_logged_in() {   if (!logged_in()) {     include "error404.php";     exit;   } }  confirm_logged_in(); require_once("connection.php");  $query="select * home"; $homeinfo = mysql_query($query, $connection); $result = mysql_fetch_array($homeinfo);  $content = $result['content']; $rssfeeds = $result['rssfeeds']; $message = ""; if(isset($_post['submit'])){   $content = $_post['content'];   $rssfeeds = $_post['rssfeeds'];   if($content == "" || $rssfeeds == ""){     $message = "please enter fields";   } else {     $query = "update home set content='$content',rssfeeds='$rssfeeds' id=1 limit 1";     $result = mysql_query($query,$connection);     if(!$result){       echo "error".mysql_error();     }     if ($result == 1) {       header("location:adminindex.php");     } else {       $message = "error occurred";     }   } } if(isset($_post['cancel'])){   header("location:adminindex.php"); } ?> 

use ob_start() @ top of php page;


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -