I'm pretty new to all this PHP... and would appreciate it if anyone could help...
I'm getting the following error:
Warning: Cannot add header information - headers already sent by (output started at /home/gassi01/public_www/Cart/addCart.php:5) in /home/gassi01/public_www/Cart/addCart.php on line 13
When I run the below script:
Code: Select all
<?
require("Cart.php");
DBinfo();
Root();
mysql_connect("$DBHost","$DBUser","$DBPass");
mysql_select_db($DBName);
mysql_query("INSERT INTO CartItems VALUES
('$UID','$ItemID','$ItemQuantity','$Date','$CartItemsID')");
Header("Location: $Relative/viewCart.php?UID=$UID");
?>The cart.php file that it links through to in order to access the DB is:
Code: Select all
<?
/* Replace these variables with information about your company */
$Company ="donassi co";
$Address1="555 Any St.";
$Address2="PO Box 3";
$City ="London";
$State ="UK";
$Zip ="BR7 6EZ";
$Phone ="+44 077 590 13806";
$Web ="http://www.yoursite.com/";
$Email ="don_assi@postmaster.co.uk";
$NoShipping = "Shipping Extra";
function Brand() {
global $Company,$Address1,$Address2,$City,$State,$Zip,$Phone,$Web,$Email,$NoShipping;
}
/* Replace these variables with information for connecting to your
database server */
$DBHost="hermes";
$DBUser="gassi01";
$DBPass="Capone77";
$DBName="gassi01db";
function DBInfo() {
global $DBHost,$DBUser,$DBPass,$DBName;
}
/* Replace these variables with the absolute and relative paths to your
MyCart scripts */
$WebRoot="home/gassi01/public_www/Cart";
$Relative="/~gassi01/Cart";
$WebHost="hermes.dcs.bbk.ac.uk";
function Root() {
global $WebRoot,$Relative,$WebHost;
}
function redFont($font,$text) {
echo "<FONT FACE="$font" COLOR="red">$text</FONT>";
}
function blueFont($font,$text) {
echo "<FONT FACE="$font" COLOR="blue">$text</FONT>";
}
function colorFont($color,$font,$text) {
echo "<FONT FACE="$font" COLOR="$color">$text</FONT>";
}
function fontFace($font,$text) {
echo "<FONT FACE="$font">$text</FONT>";
}
function fontSize($size,$color,$font,$text) {
echo "<FONT FACE="$font" COLOR="$color" SIZE="$size">$text</FONT>";
}
function commonHeader($Company,$title) {
echo "<HTML><TITLE>$Company Shopping Cart - $title</TITLE><BODY BGCOLOR="#FFFFFF">";
}
function receiptHeader($Company,$title) {
echo "<HTML><TITLE>$Company Receipt - $title</TITLE><BODY BGCOLOR="#FFFFFF">";
}
function commonFooter($Relative,$UID) {
echo "<center><br><br><hr width="70%"><br>";
echo "<b><a href="$Relative/checkout.php?UID=$UID">Go To The Check Out Stand</a></b><br><br>";
echo "<b><a href="$Relative/viewCart.php?UID=$UID">View The Contents Of Your Cart</a></b><br><br>";
fontFace("Arial","<a href="$Relative/index.php?UID=$UID">Our Catalog</a>");
fontFace("Arial"," | <a href="/">Home</a>");
echo "<br><br></center></BODY></HTML>";
}
function adminFooter($Relative) {
echo "<center><br><br><hr width="70%"><br>";
fontFace("Arial"," | <a href="$Relative">Our Catalog</a>");
fontFace("Arial"," | <a href="$Relative/admin/">Shopping Cart Admin</a>");
fontFace("Arial"," | <a href="http://modems.rosenet.net/mysql/">MySQL Utilities</a>");
fontFace("Arial"," | <a href="http://www.rosenet.net/">Rosenet</a>");
echo "<br><br></center></BODY></HTML>";
}
function receiptFooter($Company) {
echo "<br><br><center>";
fontFace("Arial","Thank you for ordering from <b>$Company</b>");
echo "</center><br><br>";
}
?>So it seems that the information is being sent twice... is there anything wrong with the script?
Really would appreciate your help...
Thanks
don_assi