Page 1 of 1

an odd error...

Posted: Tue Jun 27, 2006 9:04 pm
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.

Posted: Tue Jun 27, 2006 9:06 pm
by feyd

Code: Select all

$taxrate 0.09;
there's no operator in this statement.

Posted: Tue Jun 27, 2006 9:11 pm
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.