Looking for some help on this very interesting problem...

My INSERT statement does not INSERT! Woot!

Upon submit, the page it just simply reloads itself, even though i have specified for it to redirect to a 'done' page after adding details on noticeboard form for database...

It came with error message on top saying:

Warning: Cannot modify header information - headers already sent by (output started at /public/www/CMS/cms_head.php:2) in /public/www/CMS/addnoticeboard.php on line 67

It did add details to database with no problem - but it won't redirect to another page after hitting the submit button.

Here is bit of my php code for this.... see if there is any mistake?

PHP Code:
<?php require_once('Connections/mysql_connect_cms.php'); ?>
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);

$date_start $_REQUEST['year_start'] . '-' $_REQUEST['month_start']  . '-' $_REQUEST['day_start']; 
$date_expiry $_REQUEST['year_expiry'] . '-' $_REQUEST['month_expiry']  . '-' $_REQUEST['day_expiry'];

  if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "addNoticeboard")) {
$insertSQL sprintf("INSERT INTO noticeboard (firstname, surname, email, phone_voice, phone_text, phone_mobile, fax, address_no, address_street, address_towncity, address_postcode, address_county, date_start, date_expiry, title, sub_title, advert, approved) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['firstname'], "text"),
GetSQLValueString($_POST['surname'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['phone_voice'], "text"),
GetSQLValueString($_POST['phone_text'], "text"),
GetSQLValueString($_POST['phone_mobile'], "text"),
GetSQLValueString($_POST['fax'], "text"),
GetSQLValueString($_POST['address_no'], "text"),
GetSQLValueString($_POST['address_street'], "text"),
GetSQLValueString($_POST['address_towncity'], "text"),
GetSQLValueString($_POST['address_postcode'], "text"),
GetSQLValueString($_POST['address_county'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['sub_title'], "text"),
GetSQLValueString($_POST['advert'], "text"),
GetSQLValueString($_POST['approved'], "int"));

$Result1 mysql_query($insertSQL$mysql_connect_cms) or die(mysql_error());
$insertGoTo "pages.php?view=addnoticeboard_done";
  if (isset(
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s"$insertGoTo));