God haven't been this stuck since I learned HTML last year...
Just picked up a book on PHP, and I'm trying to get one of the examples from it to work.
<?php
$tireqty = $POST['tireqty'];
$oilqty = $POST['oilqty'];
$sparkqty = $_POST['sparkqty'];
?>
<?php
echo 'Order processed at ';
echo date('H:i, jS F');
echo '<br /><br />';
if( $totalqty == 0 )
{
echo 'You did not order anything on the previous page<br />';
}
else
{
if ( $tireqty>0 )
echo $tireqty.' tires<br />';
if ( $oilqty>0 )
echo $oilqty.' bottles of oil<br />';
if ( $sparkqty>0 )
echo $sparkqty.' spark plugs<br />';
}
$totalqty = $tireqty + $oilqty + $sparkqty;
echo 'Items ordered: '.$totalqty.'<br />';
$totalamount = 0.00;
define('TIREPRICE', 100);
define('OILPRICE', 10);
define('SPARKPRICE', 4);
$totalamount = $tireqty TIREPRICE
+ $oilqty OILPRICE
+ $sparkqty * SPARKPRICE;
echo 'Subtotal: €'.number_format($totalamount,2).'<br />';
$taxrate = 0.21; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
echo 'Total including tax: €'.number_format($totalamount,2).'<br />';
?>
</body>
</html>
Its supposed to give the "if" value if nothing is entered on the form on the previous page. But it doesn't. It just shows the "You have not ordered anything" message all the time, even when quantities have been entered! It's really beginning to piss me off. Any help appreciated.