Solved

Parse Error

Posted on 2004-03-22
1
229 Views
Last Modified: 2012-05-04
Arg I got dumped with a spring break assignment and I have no way of getting help in class and I can't figure out what's wrong with this thing for the life of me, it's my first php project.

There's an html form that processes to a php page to calculate prices. The error I get is: \Parse error: parse error, expecting `','' or `';'' in /home/virtual/site54/fst/var/www/html/processingorder.php on line 42

here's the php code I marked line 42:


<?
echo "<P>Order Processed.";
echo date("H:i, jS F");
echo "<br>";
echo $flour." bags of flour<BR>";
echo $juice." cartons of juice<BR>";
echo $chicken." roast chickens<BR>";
echo $donut." containers of donuts<BR>";
echo $cereal." boxes of cereal<BR>";
echo $banana." bunches of bananas<BR>";
echo $potato." sacks of pototoes<BR>";
echo $gum." packages of bubble gum<BR>";
echo $peas." bags of frozen peas<BR>";
echo $cheese." blocks of cheese<BR>";

$totalqty = 0;
$totalamount = 0.00;

define("FLOURPRICE", 25);
define("JUICEPRICE", 5);
define("CHICKENPRICE", 18);
define("DONUTPRICE", 1);
define("CEREALPRICE", 8);
define("BANANAPRICE", 2);
define("POTATOPRICE", 11);
define("GUMPRICE", 1);
define("PEASPRICE", 6);
define("CHEESEPRICE", 14);

$totalqty = $flour + $juice + $chicken + $donut + $cereal + $banana + $potato + $gum + $peas + $cheese;
$totalamount = $flour * FLOURPRICE
+ $juice * JUICEPRICE
+ $chicken * CHICKENPRICE + $donut * DONUTPRICE + $cereal * CEREALPRICE + $banana * BANANAPRICE + $potato * POTATOPRICE + $gum * GUMPRICE + $peas * PEASPRICE + $cheese * CHEESEPRICE;


$totalamount = number_format($totalamount, 2);
echo "<BR>\n";
echo "Items ordered: ".$totalqty."<br>\n;

$totalamount = $totalamount;
$totalamount = number_format($totalamount, 2);
echo "Total Including Tax: $".$totalamount."<BR>\n";  //This is line 42
?>
0
Comment
Question by:Wraith10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 33

Accepted Solution

by:
snoyes_jw earned 50 total points
ID: 10653342
Missing quote on this line (38?)
echo "Items ordered: ".$totalqty."<br>\n;
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question