Cannot modify header information - headers already sent by
I know this is somewhat common, but can't seem to figure it out from other threads.
Error message --- Cannot modify header information - headers already sent by (output started at /home/content/15/8359915/html/registeredUsers_Registration.php:61) in /home/content/15/8359915/html/registeredUsers_Registration.php on line 92
Here is my code
<?php require_once('Connections/conncoressentinc.php'); ?>
<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_rs_users = "-1";
if (isset($_POST['userEmail'])) {
$colname_rs_users = ($_POST['userEmail']);
}
mysql_select_db($database_conncoressentinc, $conncoressentinc);
$query_rs_users = sprintf("SELECT * FROM registeredUsers WHERE userEmail = %s", GetSQLValueString($colname_rs_users, "text"));
$rs_users = mysql_query($query_rs_users, $conncoressentinc) or die(mysql_error());
$row_rs_users = mysql_fetch_assoc($rs_users);
$totalRows_rs_users = mysql_num_rows($rs_users);
?>
<?php
if (isset($_POST["Register"])) {
$WAFV_Redirect = "registeredUsers_Registration.php";
$_SESSION['WAVT_registeredUsersRegistration_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateNM($totalRows_rs_users . "",-1,0,"",",.",true,1);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"registeredUsersRegistration");
}
}
?>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "WAATKRegistrationForm")) {
$insertSQL = sprintf("INSERT INTO registeredUsers (company_name, first_name, last_name, job_title, address1, address2, country, city, `state`, zip, userEmail, userPassword, phone, phone_extension) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['company_name'], "text"),
GetSQLValueString($_POST['first_name'], "text"),
GetSQLValueString($_POST['last_name'], "text"),
GetSQLValueString($_POST['job_title'], "text"),
GetSQLValueString($_POST['address1'], "text"),
GetSQLValueString($_POST['address2'], "text"),
GetSQLValueString($_POST['country'], "text"),
GetSQLValueString($_POST['city'], "text"),
GetSQLValueString($_POST['state'], "text"),
GetSQLValueString($_POST['zip'], "text"),
GetSQLValueString($_POST['userEmail'], "text"),
GetSQLValueString($_POST['userPassword'], "text"),
GetSQLValueString($_POST['phone'], "text"),
GetSQLValueString($_POST['phone_extension'], "text"));
mysql_select_db($database_conncoressentinc, $conncoressentinc);
$Result1 = mysql_query($insertSQL, $conncoressentinc) or die(mysql_error());
$insertGoTo = "registeredUsers_LogIn.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>