2011-08-02 48 views
-1
Notice: Undefined variable: note in /home/content/02/8116402/html/test5.php on line 48 

Warning: Cannot modify header information - headers already sent by (output started at  
/home/content/02/8116402/html/lock.php:16) in /home/content/02/8116402/html/test5.php on line 61 

<?php 
include('lock.php'); 
?> 
<?php echo $login_session; ?> 
<?php 
ini_set('display_errors', 'On'); 
error_reporting(E_ALL); 
?> 
<?php require_once('Connections/cms.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; 
} 
} 

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

幫助---------- CODE IN QUESTION需要與CONCAT_WS

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "lead_note_form")) { 
$note = date("m/d/y H:i:s")." - ".$_SESSION['username']. '\n' . $note. '\n'; 
$updateSQL = sprintf ("UPDATE Leads SET Notes = CONCAT_WS('\n', Notes, %s) WHERE Id=%d", 
    GetSQLValueString($_POST['note'], "text"), 
    GetSQLValueString($_POST['Id'], "int")); 

---------- CODE IN QUESTION

mysql_select_db($database_cms, $cms); 
    $Result1 = mysql_query($updateSQL, $cms) or die(mysql_error()); 

    $updateGoTo = "test6.php"; 
    if (isset($_SERVER['QUERY_STRING'])) { 
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; 
    $updateGoTo .= $_SERVER['QUERY_STRING']; 
} 
    header(sprintf("Location: %s", $updateGoTo)); 
} 

$colname_Recordset1 = "-1"; 
if (isset($_GET['Id'])) { 
$colname_Recordset1 = $_GET['Id']; 
} 
mysql_select_db($database_cms, $cms); 
$query_Recordset1 = sprintf("SELECT Id, First_Name, Last_Name, Notes FROM Leads WHERE Id = %s",  
GetSQLValueString($colname_Recordset1, "int")); 
$Recordset1 = mysql_query($query_Recordset1, $cms) or die(mysql_error()); 
$row_Recordset1 = mysql_fetch_assoc($Recordset1); 
$totalRows_Recordset1 = mysql_num_rows($Recordset1); 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

<script language="JavaScript" src="jquery.js" type="text/javascript"></script> 

<script> 
function clickSubmit() { 
$("form").submit(); 

</script> 

</head> 

<body> 

<table><tr><td> 

<div id="lead_box"> 
<form action="<?php echo $editFormAction; ?>" method="POST" name="lead_note_form" id="lead_note_form"  

target="_top"> 


<input type="hidden" name="Id" id="Id" value="<?php echo $row_Recordset1['Id']; ?>" /> 
<table width="100%" border="0" cellpadding="0" cellspacing="5"> 
<tr> 
<td colspan="2" bgcolor="#eeeeee"><p align="center" class="name"></p></td> 
</tr> 
<tr> 
<td><textarea rows="15" style="width: 99%" readonly><?php echo $row_Recordset1['Notes']; ?></textarea>  
</td> 
</tr> 
    <tr> 
<td valign="top"><p class="title">Add Note:</p></td> 
<tr> 
<td> 
    <textarea name="note" id="note" style="width: 99%" rows="5"></textarea> 
    </td> 
    </tr> 
</table> 
<input type="hidden" name="MM_update" value="lead_note_form" /> 
</form> 
</div><!-- and of lead box --> 
</td></tr> 
<tr><td> 
<div align="right"> 
<input type="submit" name="save" id="save" value="Save" onClick="clickSubmit()"/> 
<input type="button" name="cancel" id="cancel" value="Cancel" onClick="window.parent.hidePopWin()"/> 
</div> 
</td></tr></table> 



</body> 
</html> 
<?php 
mysql_free_result($Recordset1); 
<? 
+0

鏈接:http://stackoverflow.com/q/6906574/283366 – Phil

+0

什麼「日期/時間」?顯示你的輸出代碼 – Phil

+0

你還介意提出一個問題嗎? – deceze

回答

0

我無法很好地檢查一切。所以如果我的回答不是你需要的,請不要理它。

您的變量$note之前未定義。通常這在php中不是問題。但是如果你想接收來自php的通知,那麼這些通知將作爲標題信息發送。現在你正在獲得其中一個。之後的警告是關於標題,因爲您在通知後發送另一個標題信息。

我想有兩種不同的方法;

1-在爲它們分配任何值之前,請仔細定義所有變量。 2-關閉您的php設置中的通知消息。