Jump to content

Cannot modify header error


joesaddigh

Recommended Posts

Hi,

 

I cannot see any problem with my code which would cause this error and was wondering if anybody had any advice.

 

The error message is:

Warning: Cannot modify header information - headers already sent by (output started at E:\domains\l\languageschoolsuk.com\user\htdocs\admin\update_school_form_submit.php:101) in E:\domains\l\languageschoolsuk.com\user\htdocs\admin\update_school_form_submit.php  on line 111

 

After a little reading it seems that this is usually caused by white space but my code seems to be fine?

 

update_school_form_submit.php (below)

<?php
include "securitycheck.php";
//Writing to the database so needs admin privileges 
include("includes/connection.php");	

//Get personal details from enrolment form
$schoolname = mysql_real_escape_string($_POST["schoolname"]); 
$street = mysql_real_escape_string($_POST["street"]);
$town = mysql_real_escape_string($_POST["town"]);
$city = mysql_real_escape_string($_POST["city"]);
$county = mysql_real_escape_string($_POST["county"]);
$postcode = mysql_real_escape_string($_POST["postcode"]);
$region = mysql_real_escape_string($_POST["region"]);
$country = mysql_real_escape_string($_POST["country"]);
$schoolfacts = mysql_real_escape_string($_POST["schoolfacts"]);
$generalinfo = mysql_real_escape_string($_POST["generalinfo"]);
$accreditations = mysql_real_escape_string($_POST["accreditations"]);
$schoolid = mysql_real_escape_string($_POST["schoolid"]);
$video = mysql_real_escape_string($_POST["video"]);

// Default values to no and check if any have been set.
$library = $cafecanteen = $garden = $computer_lab = $language_lab = $internet_access =
$self_study_center = $student_lounge = $disabled_access = $disabled_access = $disabled_access =
$bookshop = $disabled_access_ac = "no";

if( isset( $_POST["library"] ) )
{
	$library = mysql_real_escape_string($_POST["library"]);
}

if( isset( $_POST["cafecanteen"] ) )
{
	$cafecanteen = mysql_real_escape_string($_POST["cafecanteen"]);
}

if( isset( $_POST["garden"] ) )
{
	$garden = mysql_real_escape_string($_POST["garden"]);
}

if( isset( $_POST["computer_lab"] ) )
{
	$computer_lab = mysql_real_escape_string($_POST["computer_lab"]);
}

if( isset( $_POST["language_lab"] ) )
{
	$language_lab = mysql_real_escape_string($_POST["language_lab"]);
}

if( isset( $_POST["internet_access"] ) )
{
	$internet_access = mysql_real_escape_string($_POST["internet_access"]);
}

if( isset( $_POST["self_study_center"] ) )
{
	$self_study_center = mysql_real_escape_string($_POST["self_study_center"]);
}

if( isset( $_POST["student_lounge"] ) )
{
	$student_lounge = mysql_real_escape_string($_POST["student_lounge"]);
}

if( isset( $_POST["disabled_access"] ) )
{
	$disabled_access = mysql_real_escape_string($_POST["disabled_access"]);
}

if( isset( $_POST["bookshop"] ) )
{
	$bookshop = mysql_real_escape_string($_POST["bookshop"]);
}

if( isset( $_POST["disabled_access_ac"] ) )
{
	$disabled_access_ac = mysql_real_escape_string($_POST["disabled_access_ac"]);
}


//Update
//Set the query
echo $queryupdate ="UPDATE school
	  SET name = '".$schoolname."', street = '".$street."', town = '".$town."',
	  city = '".$city."', county = '".$county."', region = '".$region."', postcode = '".$postcode."',
	  country = '".$country."', school_facts = '".$schoolfacts."', general_info = '".$generalinfo."',
	  accreditations = '".$accreditations."',  
	  library = '".$library."',
	  cafecanteen = '".$cafecanteen."',
	  garden = '".$garden."',
	  computer_lab = '".$computer_lab."',
	  language_lab = '".$language_lab."',
	  internet_access = '".$internet_access."',
	  self_study_center = '".$self_study_center."',
	  student_lounge = '".$student_lounge."',
	  disabled_access = '".$disabled_access."',
	  bookshop = '".$bookshop."',
	  disabled_access_ac = '".$disabled_access_ac."',
	  video = '".$video."'
	  WHERE school_id = " .$schoolid;
	 $result = mysql_query($queryupdate) 
		or die("Error updating the school");

	// Return to form 
	mysql_close($conn);

	$success = $schoolname . " Was updated!";

	//Redirect to add images page 
	header("Location: update_school_form.php? success=$success");
	exit();
?>

 

 

Thanks in advance,

Joe

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.