Warning: Cannot modify header information

what is the reasone of this problem
Warning: Cannot modify header information - headers already sent by (output started at /updatecon.php:16) in /includes/functions.php on line 66
this line 16 at updatecon.php

	<script src="includes/lib/prototype.js" type="text/javascript"></script>

and this line 66 at function.php

function redirect($smsg,$red) {

	set_msg($smsg);
	header('Location: '.$red); die;
}

You must not echo anything to the browser before using header() function. That means no js includes, no messages, no anything.

this is all code of the page
i don’t know where is the problem?

<?php require_once('includes/config.php');
include('includes/includes.php');
$pagetitle = '';

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Update Person</title>
<link href="includes/style.css" rel="stylesheet" type="text/css" />
	<script src="includes/lib/prototype.js" type="text/javascript"></script>
<script src="includes/src/effects.js" type="text/javascript"></script>
<script src="includes/validation.js" type="text/javascript"></script>
	<script src="includes/src/scriptaculous.js" type="text/javascript"></script>
 <script language="javascript">
 var id = 2;
 function add_phone_field()
 {
  var obj = document.getElementById("phone");
  var data = obj.innerHTML;
  data += "<input type='text' name='person_phone[]' id='person_phone"+id+"' /><br /><br />";
  obj.innerHTML = data;
  id++;
  }
 </script>
</head>

<body>

<?php include('includes/header.php'); ?>
<?php
$sqlp="select * from persons where person_id=".$_GET['id']."";
$rsp = mysql_query($sqlp);

?>
<div class="container">
  <div class="leftcolumn">
<form method="post" action="" enctype="multipart/form-data">
  <table width="800" border="0" dir="rtl" style="direction:ltr;">
  <?php while($rowp = mysql_fetch_array($rsp)){ ?> <tr>
      <td scope="col" style="direction:rtl;"><label for="textfield">&#1575;&#1604;&#1575;&#1587;&#1605;</label>
        
        <div align="right">
          <input type="text" name="person_name" id="person_name" value="<?php echo $rowp['person_name']?>" />
          </div></td>
   
    </tr>
    <tr>
      <td style="direction:rtl;"><label for="textfield">&#1575;&#1604;&#1608;&#1592;&#1610;&#1601;&#1577;</label>
        
        <div align="right">
          <input type="text" name="person_job" id="person_job"  value="<?php echo $rowp['person_job']?>"/>
          </div></td>
     
    </tr>
    <tr>
      <td style="direction:rtl;"><label for="label">&#1575;&#1604;&#1580;&#1608;&#1575;&#1604;</label>
        
        <div align="right">
          <input type="text" name="person_mobile" id="person_mobile"  value="<?php echo $rowp['person_mobile']?>"/>
          </div></td>
     
    </tr>
	  <tr>
      <td style="direction:rtl;"><label for="label2" >&#1575;&#1604;&#1578;&#1604;&#1610;&#1601;&#1608;&#1606;</label>
        <span style="color:#00f;font-size:20px;font-weight:bold;cursor:pointer;" onclick="add_phone_field()">[+]</span>
				<?php  $persphone=$rowp['person_phone']; $persphone1=explode(",", $persphone); 
		 foreach($persphone1 as $phone)
 {?>
        <div id="phone" align="right">

    <input type="text" name="person_phone[]" id="person_phone1" value="<?php
 echo  $phone  ;?>"
 /> <br /> <br />
          </div><?php } ?></td>

    </tr>
   <!-- <tr>
      <td style="direction:rtl;"><label for="label2">&#1578;&#1604;&#1610;&#1601;&#1608;&#1606; &#1575;&#1604;&#1593;&#1605;&#1604;</label>
        
        <div align="right">
          <input type="text" name="person_phone" id="person_phone"  value="<?php echo $rowp['person_phone']?>"/>
          </div></td>
      
    </tr>-->
    <tr>
      <td style="direction:rtl;"><label for="label3">&#1575;&#1604;&#1575;&#1610;&#1605;&#1610;&#1604;</label>
        
        <div align="right">
          <input type="text" name="person_email" id="person_email"    value="<?php echo $rowp['person_email']?>"/>
          </div></td>
      
    </tr>
    <tr>
      <td><label for="label4"></label>
        
        <div align="right"></div></td>
      
    </tr>
	 <tr>
          <td colspan="2"><p align="right">
                     
              <input name="add" type="submit" id="add" value="&#1578;&#1593;&#1583;&#1610;&#1604;" />
          </p></td>
        </tr><?php } ?>
  </table>
</form>
<?php
if(isset($_POST['add']) )
{
$person_id=$_GET['id'];

$person_name=mysql_real_escape_string($_POST['person_name']);
$person_job=mysql_real_escape_string($_POST['person_job']);

$person_mobile=  mysql_real_escape_string($_POST['person_mobile']);
$separator = ",";
  foreach($_POST["person_phone"] as $value)
  {
   $person_phone .= $value.$separator;
   }
  $person_phone = rtrim($person_phone,$separator); 
/* $person_phone=  addslashes($_POST['person_phone']);*/
$person_email=  addslashes($_POST['person_email']);
$contact_id=addslashes($_GET['id']);


$sql_insb="update persons set person_name='$person_name' ,person_job='$person_job', person_mobile='$person_mobile' ,person_phone='$person_phone', person_email='$person_email' where person_id=$person_id";
 
if (!mysql_query($sql_insb,$contacts))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record updated";

$sqli="select * from persons where person_id=$person_id";
$rid=mysql_query($sqli)or die(mysql_error());
while($row=mysql_fetch_array($rid)){

$un= $row['contact_id'];

		$redirect = "perdetails.php?id=$un";
	redirect('Person details Updated',$redirect);
}
}

mysql_close($contacts);
?>
 
 </div>
  
  <br clear="all" />
</div>
</body>
</html>

I think

echo "1 record updated";

might causing you problems.

no,i removed this line but the same problem

Maybe you missed this?

thanks for all
solved
:):):slight_smile: