an odd error...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mabufo
Forum Commoner
Posts: 81
Joined: Thu Jul 10, 2003 11:11 pm
Location: Orland Park, IL
Contact:

an odd error...

Post by mabufo »

I recieve this error when trying to indirectly manipulate input recieved through a form.

Code: Select all

Parse error: parse error, unexpected T_DNUMBER in /home/mabufo/www/action.php on line 54
My code is as follows:

Code: Select all

<?php
	/* This scripts interprets, and builds upon,
	the information entered into the form that is
	found on the index.php page. */	


	//changes medium variable names to small names.
	$tireqty = $_POST['tireqty'];
	$oilqty = $_POST['oilqty'];
	$sparkqty = $_POST['sparkqty'];


	echo 'You have ordered: <br />';

	//outputs form values
	echo "$tireqty Tires <br />";
	echo "$oilqty Oil Cans <br />";
	echo "$sparkqty Spark Plugs <br />";

	//tallies up the total amount of items
	$totalqty = 0;
	$totalqty = $tireqty + $oilqty + $sparkqty;
	echo "Items ordered: $totalqty";
	

	$totalamount = 0.00;

	//needed constants
	define('TIREPRICE', 100);
	define('OILPRICE', 10);
	define('SPARKPRICE', 4);

	
	//tallies up total cost
	$totalamount = $tireqty * TIREPRICE
		+ $oilqty * OILPRICE
		+ $sparkqty * SPARKPRICE;

	/* this statement outputs the cost, without tax
	   The number_format() function is a php math 
	   command that sets decimal places on the number
	   passed to the function                         */
	echo 'Subtotal: $'.number_format($totalamount,2).'<br />';


	//calculates the cost - with tax.
	$taxrate 0.09;
	$totalamount = $totalamount * (1 + $taxrate);
	echo 'Total including tax: $'.number_format($totalamount,2).'<br />';


?>
I've really have no idea as to what I'm supposed to fix - I can't spot the error.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$taxrate 0.09;
there's no operator in this statement.
User avatar
mabufo
Forum Commoner
Posts: 81
Joined: Thu Jul 10, 2003 11:11 pm
Location: Orland Park, IL
Contact:

Post by mabufo »

feyd wrote:

Code: Select all

$taxrate 0.09;
there's no operator in this statement.
doh silly me! I think It's time for a break.
Post Reply