Jump to content

Charity needs help on one php page stubbornly holding our website back!


olfrog

Recommended Posts

we have one of those

Warning: Cannot modify header information - headers already sent by (output started at /home/sites/himalayanlearning.org/public_html/sponsor-donation-form.php:40) in..

problems on our donation webpage http://www.himalayanlearning.org/sponsor-donation-form.php
that we cannot get rid of! we have [b]tried finding extra spaces, extra lines[/b] and so on, but it still won't leave and it's getting really annoying!

could any kind soul help us by having a look at the page? the line that the above complaint is targeted is below and is

<META NAME="Keywords" CONTENT="sponsor a child"><META NAME="Copyright" CONTENT="Himalayan Learning Registered Charity 1103105"><META NAME="Distribution" CONTENT="Global"><META NAME="Robots" CONTENT="all"><META http-equiv="Robots" content="index, follow">

and doesn't have any php in it. we have looked for spaces at the top and at the bottom of the page. we use dreamweaver on a mac.

the top of the php code is below,

...................
<?php include 'connections/db.php';
session_start();
$user = $_SESSION['id'];
switch($_GET["action"]){case "add_item":{AddItem($_GET["id"], $_GET["qty"]);ShowCart();break;}
case "update_item":{UpdateItem($_GET["id"], $_GET["qty"]);ShowCart();break;}
case "remove_item":{RemoveItem($_GET["id"]);ShowCart();break;}
default:{ShowCart();}
}
function AddItem($itemId, $qty){
global $hostname_db, $username_db, $password_db, $database_db;
$cxn = @ConnectToDb($hostname_db, $username_db, $password_db, $database_db);
$result = mysql_query("select count(*) from cart where cookieId = '" . GetCartId() . "' and itemId = $itemId");
$row = mysql_fetch_row($result);
$numRows = $row[0];
if($numRows == 0){@mysql_query("insert into cart(cookieId, itemId, qty) values('" . GetCartId() . "', $itemId, $qty)");}
else{UpdateItem($itemId, $qty);}
}
function UpdateItem($itemId, $qty){
global $hostname_db, $username_db, $password_db, $database_db;
$cxn = @ConnectToDb($hostname_db, $username_db, $password_db, $database_db);
if($qty == 0){RemoveItem($itemId);}
else{mysql_query("update cart set qty = $qty where cookieId = '" . GetCartId() . "' and itemId = $itemId");}
}
function RemoveItem($itemId){
global $hostname_db, $username_db, $password_db, $database_db;
$cxn = @ConnectToDb($hostname_db, $username_db, $password_db, $database_db);
mysql_query("delete from cart where cookieId = '" . GetCartId() . "' and itemId = $itemId");
}
function ShowCart(){
global $hostname_db, $username_db, $password_db, $database_db;
$cxn = @ConnectToDb($hostname_db, $username_db, $password_db, $database_db);
$totalCost = 0;
$delivery = 0; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="EN">
<head>
<Title>Himalayan Learning Form</title>
<META NAME="Author" CONTENT="Oliver Spencer-Shrestha">
<META NAME="Description" CONTENT="sponsor a child for just &pound;7 per year">
<META NAME="Keywords" CONTENT="sponsor a child"><META NAME="Copyright" CONTENT="Himalayan Learning Registered Charity 1103105"><META NAME="Distribution" CONTENT="Global"><META NAME="Robots" CONTENT="all"><META http-equiv="Robots" content="index, follow">
...................

if anybody could help, that would be fantastic and would help us get more kids out of child labour quicker!

thanks
oliver
himalayan learning
check your connections/db.php for spaces, too. there should be NO whitespace before or after the <?php ?> tags in the db file.

otherwise, take a look at [url=http://www.php.net/ob_start]ob_start[/url]
hi,

thanks very much, i have gone through the connect file and checked it for spaces, and have deleted the 3 i found that were inbetween code, however there was nothing before or after the <?php codes start and finish.

regarding ob_start can i just clarify after reading it, this stops the problem being shown in the browser window, is that right? it's really just to cover up what is going on - which is finee, because it all works fine anyway!

is that right?

thanks in advance

oliver@ himalayan learning

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.