We help IT Professionals succeed at work.
Get Started

My PHP Shopping Cart won't allow me to exceed $999.99. How do I get it to go into the thousands?

marcleo asked
Last Modified: 2013-11-18
To see what I'm talking about, go to http://www.onlineboosterclub.com/storefront. Select Youth Sports Foundation followed by any group and team that appears. Go to the T-shirts category and put 66 regular sized shirts in the cart. You'll see the total is $986.70. Update the cart to add the 67th shirt and the total goes to $1.00. What am I doing wrong? Below is the code that creates each table row of the shopping cart.
$subtotal = $price * $quantity;
$subtotal = number_format($subtotal,2);
$total += $subtotal;
$total = number_format($total,2);
$ucsize = strtoupper($size);
echo "<form action=\"index.php?org=$currentorgid&group=$currenttownid&team=$currentteamid\" method=\"post\" onsubmit=\"return formValidator()\">\n";
echo "<tr><td style=\"text-align: center\"><a href=\"index.php?org=$currentorgid&group=$currenttownid&team=$currentteamid&content=viewproduct&product=$apparelid&temporg=$orgid&tempgroup=$townid&tempteam=$teamid&tempapcolor=$nospaceapcolorname&tempdscolor=$nospacedscolorname\"><img src=\"images/designsonproduct/sm/$teamid-";

if ($designnumberlength == 1)
	echo "00";
else if  ($designnumberlength == 2)
	echo "0";
else if ($designnumberlength == 3)
	echo "";
echo "$designnumber-$nametouselow-$nospacedscolorname-$nospaceapcolorname-$cattouse.jpg\" style=\"width: 80px; height: 80px\" alt=\"$brand $shortdesc\" title=\"$brand $shortdesc\" /></a></td><td><a href=\"index.php?org=$currentorgid&group=$currenttownid&team=$currentteamid&content=viewproduct&product=$apparelid&temporg=$orgid&tempgroup=$townid&tempteam=$teamid&tempapcolor=$nospaceapcolorname&tempdscolor=$nospacedscolorname\">$brand $shortdesc</a></td><td>$ucsize</td><td>$nametouse<br />Design #$designnumber<br />$dscolorname on $apcolorname</td>";

printf("<td style=\"text-align: right\">$%.2f</td>\n", $price);
echo "<td><input type=\"text\" name=\"quantity\" id=\"quantity\" value=\"$quantity\" size=\"2\" maxlength=\"2\" /></td>\n";
printf("<td style=\"text-align: right\">$%.2f</td>\n", $subtotal);

echo "<td style=\"border: none\">\n";
echo "<input type=\"hidden\" name=\"content\" value=\"changeitem\">\n";
echo "<input type=\"hidden\" name=\"prodid\" value=\"$prodid\">\n";
echo "<input type=\"hidden\" name=\"sizeselection\" value=\"$size\">\n";
echo "<input type=\"submit\" name=\"button\" value=\"Update\"><br /><input type=\"submit\" name=\"button\" value=\"Remove\">\n";
echo "</td></tr>\n";
echo "</form>\n";

Open in new window

Watch Question
Most Valuable Expert 2020
Most Valuable Expert 2018
This problem has been solved!
Unlock 3 Answers and 12 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE