I have been looking through the forum regarding this a alot of peoples problems are white space or the session needs to go at the top of the page before ANYTHING else.
i am getting the following errors
the code i have in the page is (starting at line 1)PHP Code:Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 5
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/XCInc/XCart.inc on line 4
PHP Code:<?php require_once('Connections/lotties.php');
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache");
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']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE LOTTIE_voucher SET vouchCode=%s WHERE vouchID=%s",
GetSQLValueString($_POST['vouchCode'], "text"),
GetSQLValueString($_POST['vouchID'], "int"));
mysql_select_db($database_lotties, $lotties);
$Result1 = mysql_query($updateSQL, $lotties) or die(mysql_error());
}
// *** X Shopping Cart ***
$useSessions = true;
$XCName = "LottieJakeCart";
$XCTimeout = 30;
$XC_ColNames=array("ProductID","Quantity","Name","Price","Stock","Total");
$XC_ComputedCols=array("","","","","","Price");
require_once('XCInc/XCart.inc');
mysql_select_db($database_lotties, $lotties);
$query_rsVoucher = "SELECT * FROM LOTTIE_vouchercode";
$rsVoucher = mysql_query($query_rsVoucher, $lotties) or die(mysql_error());
$row_rsVoucher = mysql_fetch_assoc($rsVoucher);
$totalRows_rsVoucher = mysql_num_rows($rsVoucher);
// *** Update contents of Shopping Cart ***
require_once('XCInc/XCupdateAction.inc');
if (isset($_POST["Quantity"])) {
$XC_UpdateRedirect = "shopping-cart.php";
$values = $_POST["Quantity"];
require_once('XCInc/UpdateXCart.inc');
}
// *** Empty XCart ***
if (isset($_SERVER["QUERY_STRING"])) {
$XC_EmptyCartLink = $_SERVER["PHP_SELF"] . "?" . htmlentities($_SERVER["QUERY_STRING"]) . "&XC_EmptyCart=1";
} else {
$XC_EmptyCartLink = $_SERVER["PHP_SELF"] . "?XC_EmptyCart=1";
}
if (isset($_GET["XC_EmptyCart"]) && ($_GET["XC_EmptyCart"] == "1")) {
$XC_EmptyCartRedirect = "shopping-cart.php";
require_once('XCInc/XCemptyRedirect.inc');
}
// *** Repeat XCart region *** (do not remove this label)
// voucher code
if (isset($_POST['vouchCode']) && $_POST['vouchCode'] == $row_rsVoucher['VCode']) {
$mycode = $row_rsVoucher['VCode'];
$spos = strpos($mycode, "c");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
$myvalue = $XCart_sumTotal * $myvalue / 100;
} else {
$spos = strpos($mycode, "p");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
}
}
$myTotal = $XCart_sumTotal - $myvalue;
$_SESSION['vouchCode'] = $myvalue;
} else unset($_SESSION['vouchCode']);
function DoFormatCurrency($num,$dec,$sdec,$sgrp,$sym,$cnt) {
setlocale(LC_MONETARY, $cnt);
if ($sdec == "C") {
$locale_info = localeconv();
$sdec = $locale_info["mon_decimal_point"];
$sgrp = $sgrp!="" ? $locale_info["mon_thousands_sep"] : "";
$sym = $cnt!="" ? $locale_info["currency_symbol"] : $sym;
}
$thenum = $sym.number_format($num,$dec,$sdec,$sgrp);
return $thenum;
}
?>
the code is the shopping cart with the ability to add a discount vouchers for example
lot123p10
would be %10 of the total
can anyone advise me please
thanks in advance



Reply With Quote

.)
Bookmarks