Can't get this php script to work? What's wrong?

software development

#1

I’m attempting to learn php, but I get a Parse error from the following script: parse error, unexpected T_VARIABLE in Line 10 of the following php code:

Using Numbers <?php /* $Quantity must be passed to this page from a form or via the URL. $Discount is optional. */ $Cost = 2000.00; $Tax = 0.06 $Totalcost = $Cost * $Quantity; $Tax= $Tax 1; // $Tax is now worth 1.06. $Totalcost = $Totalcost - $Discount; $Totalcost = $Totalcost * $Tax; $Payments = $TotalCost / 12; // Print the results print ("You requested to purchase $Quantity widget(s) at \$$Cost each.\n

"); print ("The total with tax, minus your \$$Discount, comes to \$$Totalcost.\n

"); printf (".2f", $Totalcost); print ("You may purchase the widget(s) in 12 monthly installments of \$$Payments each.\n

"); printf (".2f, $Payments); print (" each.\n

"); ?>


#2

$Cost = 2000.00; $Tax = 0.06 $Totalcost = $Cost * $Quantity;
Forgot the semi-colon.


#3

Thanks Guys for checking over my sloppy code. I got it working, now that i know what to look for!

Doug