Hi! I am a newbie, and recently I have installed php, apache, and mysql on my computer. However, after type some codes the browers left ÈpartÈ of the php code on the brower. It almost seem like the browser doesnèt recognize the code or something.
below is what my browser shows
Bob's Auto Parts
Order Results
Order processed at '; echo date('H:i, jS F'); echo '
'; echo '
Your order is as follows:
'; $totalqty = 0; $totalqty = $tireqty + $oilqty + $sparkqty; echo 'Items ordered: '.$totalqty.'
'; if( $totalqty == 0) { echo 'You did not order anything on the previous page!
'; } else { if ( $tireqty>0 ) echo $tireqty.' tires
'; if ( $oilqty>0 ) echo $oilqty.' bottles of oil
'; if ( $sparkqty>0 ) echo $sparkqty.' spark plugs
'; } $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).'
'; $taxrate = 0.10; // local sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); echo 'Total including tax: $'.number_format($totalamount,2).'
'; if($find == 'a') echo '
Regular customer.
'; elseif($find == 'b') echo '
Customer referred by TV advert.
'; elseif($find == 'c') echo '
Customer referred by phone directory.
'; elseif($find == 'd') echo '
Customer referred by word of mouth.
'; else echo '
We do not know how this customer found us.
'; ?>
THis is the code that I used
<?php
// create short variable names
$tireqty = $_POST['tireqty'];
$oilqty = $_POST['oilqty'];
$sparkqty = $_POST['sparkqty'];
$find = $_POST['find'];
?>
<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php
echo '<p>Order processed at ';
echo date('H:i, jS F');
echo '</p>';
echo '<p>Your order is as follows: </p>';
$totalqty = 0;
$totalqty = $tireqty + $oilqty + $sparkqty;
echo 'Items ordered: '.$totalqty.'<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 />';
}
$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.10; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
echo 'Total including tax: $'.number_format($totalamount,2).'<br />';
if($find == 'a')
echo '<p>Regular customer.</p>';
elseif($find == 'b')
echo '<p>Customer referred by TV advert.</p>';
elseif($find == 'c')
echo '<p>Customer referred by phone directory.</p>';
elseif($find == 'd')
echo '<p>Customer referred by word of mouth.</p>';
else
echo '<p>We do not know how this customer found us.</p>';
?>
</body>
</html>
I have also attached a file with the screenshot of what I see