Jump to content

[SOLVED] Headers


TGWSE_GY

Recommended Posts

Ok there is only one place in my script that I use headers, every time it reaches the header statement I get an error that the headers are already sent.

 

 <?php

//This script will process the updates to the article that is designated by the sectionid passed from the previouse php page in the form.
//Then we will take this and store it into the correct table of the database. Remember we always call our database configuration at the start.

//Get database connectiong config
include('phpcontent/config.php');
$id = $_POST['id'];
$date = date(mdo);
/************************************************************EDIT LINES STARTING HERE**************************************************/
$tblnews = "sndreview_news";
$tblreviews = "sndreview_reviews";
$tblfeatured = "sndreview_featured";
$tblindustry = "sndreview_industry";
/************************************************************STOP EDITING HERE ********************************************************/

//Get the entries from the form.
$section = $_POST['section'];
$new_title = addslashes($_POST['title']);
$new_article = $_POST['article'];
$summary = addslashes($_POST['summary']);

$search = "src=\"http://www.soundreview.net/images/";
$replace = "src=\"images/";

$title = str_replace($search, $replace, $new_title);
$article = str_replace($search, $replace, $new_article);
$article = addslashes($article);

switch ($section) {
	case 0:
		//News
		mysql_query("UPDATE `$tblnews` SET title='$title', article='$article', summary='$summary', date='$date' WHERE id='$id'") or die(mysql_error()); 
		$sectionid = "news";
		break;
	case 1:
		//Industry
		$tbl = $tblindustry;
		mysql_query("INSERT INTO `$tblindustry` ( title , article , summary , date ) VALUES ('$title', '$article', '$summary', '$date')") or die(mysql_error()); 
		$sectionid = "radio";
		break;
	case 2:
		//Reviews
		$tbl = $tblreviews;
		mysql_query("INSERT INTO `$tblreviews` ( title , article , summary , date ) VALUES ('$title', '$article', '$summary', '$date')") or die(mysql_error()); 
		$sectionid = "reviews";
		break;
	case 3:
		//Featured
		$tbl = $tblfeatured;
		mysql_query("INSERT INTO `$tblfeatured` ( featured , date ) VALUES ('$article', '$date')") or die(mysql_error()); 
		$sectionid = "featured";
		break;
	case 4:
		$tbl = "sndreview_photos";
		mysql_query("INSERT INTO `$tbl` ( article , date ) VALUE ('$article', '$date')") or die(mysql_error());
		break;
}

header("Location: http://www.soundreview.net/admin/classes/forms/maineditor.php?section=$sectionid");
?>

 

Is there anyway to test if the header has already been sent and the clear it and send the new one? This same exact code works on several other domains without fail. And YES I AM SURE! that the headers are not being sent anywhere else in my script.

 

Thanks

 

Link to comment
Share on other sites

 

Warning: Cannot modify header information - headers already sent by (output started at /home/.valerieheater/jcnh74/soundreview.net/admin/classes/forms/process_changes.php:1) in /home/.valerieheater/jcnh74/soundreview.net/admin/classes/forms/process_changes.php on line 60

Link to comment
Share on other sites

Output is being sent in line 1 of process_changes.php

already sent by (output started at /home/.valerieheater/jcnh74/soundreview.net/admin/classes/forms/process_changes.php:1)

Eithe ryou have a space or some html before your opening <?php or the file has been saved with a BOM marker

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.