You are here: Error message « All PHP « IT news, forums, messages
Error message

Posted by T. Wintershoven on 05/16/06 12:59

Hi all,

The code in shop.php works just fine

But, when i go to pay.php, i get the following error message:

Warning: Illegal offset type in C:\Program Files\xampp\htdocs\Study\Week
8\pay.php on line 41

Is there someone who can help me please.
It has something to do with the line
$_SESSION["trolley"][$_GET["order"]]["amount"] but i can't find out what.

T.i.a.
Regards,
Tino Wintershoven
The Netherlands

--------------------------------
shop.php
--------------------------------

function CheckOrder()
{
if (isset($_GET["order"]))
{
if (isSet($_SESSION["trolley"][$_GET["bestel"]]))
{
$_SESSION["trolley"][$_GET["order"]]["amount"] =
$_SESSION["trolley"][$_GET["order"]]["amount"] + 1;
}
else
{
$_SESSION["trolley"][$_GET["order"]]["amount"] = 1;
}
}
}

---------------------
pay.php
---------------------

function ShowTrolley()
{
$trolley = $_SESSION["trolley"];
echo "<h1>Pay Time</h1>";
if (isSet($trolley) && (count($trolley)>0))
{
echo "The following items are present in your trolley:<br>";
echo "<table border='1'>";
echo "<tr><td>Book</td><td>Prise</td></tr>";
$books = ReadBooks();
$total=0;
for ($i=0;$i<count($trolley);$i++)
{
if ($_SESSION["trolley"][$i]["amount"]!="")
{
$info = explode(",", $books[$trolley[$i]]);
echo "<tr><td>".$info[0]."</td>";
echo "<td
style='text-align:right'>".number_format($info[1],2,",",".")."</td></tr>";
$total=$total+$info[1];
echo "<td><a href=pay.php?remove=$i>Remove</a></td></tr>";
}
}
echo "<tr><td><b>Total:</b></td><td
style='text-align:right'><b>".number_format($totaal,2,",",".")."</b></td></t
r>";
echo "<tr><td colspan='2'><a href='shop.php'>Continu
shopping</a></td></tr>";
echo "</table>";
}
else
{
echo "There are no items in your trolley yet<br>";
echo "Click <a href='shop.php'>here</a> to shop";
}
}

 

Navigation:

[Reply to this 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

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