Jump to content

need help with header function


doforumda

Recommended Posts

hi

 

i create a website when i checked it on my local computer everything was working fine. but when i upload it to webserver then something going wring there with header(). i.e, when the page calls header function it displays this error.

Warning: Cannot modify header information - headers already sent by (output started at /home....../profileinfosave.php:10) in /home/......../profileinfosave.php on line 103

 

please help if you need some more info about this please ask

Link to comment
Share on other sites

From the error message, you have something at or up to line 10 in profileinfosave.php that is sending output that is preventing the header from working. You would need to find and fix whatever is causing that output or you will need to rearrange the code so that the code responsible for sending the header comes before the output.

 

As to why it works on one system and not another, the php.ini output_buffering setting is either ON or is set to a specific value on your development system, thereby hiding the problem and allowing bad code to appear to work. You should turn the output_buffering setting off so that code you develop will work correctly regardless of the output_buffering setting.

Link to comment
Share on other sites

i cant see anything in my code which i am making output before header

here is my code if you can see that output

<?php session_start(); ?>

<?php 
if($_POST['save']) {
include("dbConnect.php");
//$_SESSION['userid'] = '1';
$sex = addslashes(strip_tags($_POST['sex']));
$showsex = isset($_POST['showsex']);
$month = addslashes(strip_tags($_POST['month']));
$day = addslashes(strip_tags($_POST['day']));
$year = addslashes(strip_tags($_POST['year']));
$showbirth = addslashes(strip_tags($_POST['showbirth']));
$currentcity = addslashes(strip_tags($_POST['currentcity']));
$hometown = addslashes(strip_tags($_POST['hometown']));
$homeneighbor = addslashes(strip_tags($_POST['homeneighbor']));
$status = addslashes(strip_tags($_POST['status']));
$interestedin = addslashes(strip_tags($_POST['interestedin']));
$lookingfor = addslashes(strip_tags($_POST['lookingfor']));
$religiousviews = addslashes(strip_tags($_POST['religiousviews']));
$politicalviews= addslashes(strip_tags($_POST['politicalviews']));


$dob = date($year."-".$month."-".$day);

$basicinfosave = mysql_query("UPDATE basicinfo 
						   SET 
						   currentcity='$currentcity', 
						   hometown='$hometown', 
						   homeneighborhood='$homeneighbor', 
						   relationshipstatus='$status',
						   interestedin='$interestedin',
						   lookingfor='$lookingfor',
						   religiousviews='$religiousviews',
						   politicalviews='$politicalviews'
						   WHERE userid='$_SESSION[userid]'
						   ") or die(mysql_error());
if($basicinfosave) {
$agesave = mysql_query("UPDATE basicinfo_age 
					   SET
					   sex='$sex',
					   dob='$dob',
					   sexprivacy='$showsex',
					   dobprivacy='$showbirth'
					   WHERE
					   userid='$_SESSION[userid]'
					   ");
	if($agesave) {
		header("Location: profile.php");
	}
}
}
else {
header("Location: profile.php");
}

?>

 

in above code i remove html tags but it still give the same error

Warning: Cannot modify header information - headers already sent by (output started at /home/...../profileinfosave.php:3) in /home/...../profileinfosave.php on line 48

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.