Reply to Fatal error: Call to a member function add_item() on a non-object

Your name:

Reply:


Posted by Flic on 02/02/07 15:11

Hi, I am a relative beginner with php and have run into the problem in
the subject line. I wonder if anyone could point out what the problem
is as I have tried a few different things and it still doesn't like
it.

The code itself is:

if($_POST['add']) {
$product = $products[$_POST['id']];
$cart->add_item($product['id'],$product['price'],$product['name']);
}

with the add_item line being the problem.

Just in case, it is being called using the following code:

<?php
$products = array();
$products[1] = array("id"=>123,"name"=>"Silo Venting
Filter","price"=>123.45,"sub"=>"venting_system", "desc"=>"temp");

foreach($products as $p) {
echo "<div class='acc'>";
echo "<form method='post' action='cart.php'>";
echo "<input type='hidden' name='id' value='".$p['id']."'/>";
echo "<img src='images/".$p['sub'].".jpg' alt='".$p['name']."'>";
echo "<div><h1><a class='silolink' href='accessories/".
$p['sub'].".html'>".$p['name']."</a></h1>";
echo $p['desc'];
echo "<br><br>£".$p['price'];
echo "<input type='submit' value='Add to cart' name='add'></form>";
echo "</div></div>";
}
?>

I would much appreciate it if someone could help! I learn from coding
and mistakes!

Thanks

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация