Thank you for the help. Here's the code. I get the warning:
Cannot modify header information - headers already sent by (output
started at
/Users/davidbarrack/Sites/NadolneWeb/CreatePatientConversation.php:6)
in
/Users/davidbarrack/Sites/NadolneWeb/CreatePatientConversation.php
on line 63
Line 63 is the following: header(sprintf("Location: %s",
$insertGoTo));
I had to rip out the last half of the code because of the 10K
limit on the forum page but hope that this code reveals the problem
to you.
<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once('Connections/NadolneWebDev.php'); ?>
<?php
$replyby = 48;
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType,
$theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" .
htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) &&
($_POST["MM_insert"] == "CreateConversation")) {
$insertSQL = sprintf("INSERT INTO Conversation (username,
createdatetime, topic, patientinquestion, message, replyrequestby,
reasonforurgency, status_change, notemergency) VALUES (%s, %s, %s,
%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['hiddenusername'], "text"),
GetSQLValueString($_POST['hiddencurrentdatetime'], "date"),
GetSQLValueString($_POST['topic'], "text"),
GetSQLValueString($_POST['patientinquestion'], "text"),
GetSQLValueString($_POST['message'], "text"),
GetSQLValueString($_POST['replyby'], "date"),
GetSQLValueString($_POST['reasonforurgency'], "text"),
GetSQLValueString($_POST['hiddencurrentdatetime'], "date"),
GetSQLValueString(isset($_POST['reasonforurgency']) ? "true"
: "", "defined","'Y'","'N'"));
mysql_select_db($database_NadolneWebDev, $NadolneWebDev);
$Result1 = mysql_query($insertSQL, $NadolneWebDev) or
die(mysql_error());
$insertGoTo = "PatientLanding.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
$colname_rsGetName = "-1";
if (isset($_SESSION['username'])) {
$colname_rsGetName = (get_magic_quotes_gpc()) ?
$_SESSION['username'] : addslashes($_SESSION['username']);
}
mysql_select_db($database_NadolneWebDev, $NadolneWebDev);
$query_rsGetName = sprintf("SELECT logintype, status,
firstname, lastname FROM AccountInfo WHERE username = %s",
GetSQLValueString($colname_rsGetName, "text"));
$rsGetName = mysql_query($query_rsGetName, $NadolneWebDev) or
die(mysql_error());
$row_rsGetName = mysql_fetch_assoc($rsGetName);
$totalRows_rsGetName = mysql_num_rows($rsGetName);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"><!--
InstanceBegin template="/Templates/Admin.php"
codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>1 Column Fixed, Centered</title>
<!-- InstanceEndEditable -->
<style type="text/css" media="all">
<!--