Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2005, 02:18 PM
Registered User
 
Join Date: Sep 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP5_Math

Hello
I have orderform.html and processorder.php and I am using PHP5 on Apache2. Calculation results I get are $0. On the other hand when I run same files on another server (with previous versions of both PHP and Apache, I suppose) I get all calculations right. Can anyone help me fix it?
Code of files:
'Orderform.html'
<form action="processorder.php" method=post>
<table border=0>

<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td></tr>

<tr>
<td>Tires</td>
<td align="center"><input type="text" name="tireqty" size="3" maxlength="3"></td>
</tr>

<tr>
<td>Oil</td>
<td align="center"><input type="text" name="oilqty" size="3" maxlength="3"></td>
</tr>

<tr>
<td>Spark Plugs</td>
<td align="center"><input type="text" name="sparkqty" size="3" maxlength="3"></td>
</tr>

<tr>
<td colspan="2" align="center"><input type="Submit" value="Submit order"></td>
</tr>
</table>
</form>
------------------------------------------
"processorder.php"
----
<html>
<head><title>Bob'Auto Parts-Order Results</title></head>
<Body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>

<?php
define('TIREPRICE',100);
define('OILPRICE',10);
define('SPARKPRICE',4);
echo '<P>Order Processed at ';
echo date('H:i, jS F');
echo '</p>';
echo '<P> your Order is as follows: </p> ';
$totalqty = $tireqty + $oilqty + $sparkqty;
echo 'Items ordered: '.$totalqty.'<br />';
$taxrate = 0.10;
$totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE;

echo 'Subtotal: $'.$totalamount.'<br />';
$totalamount = $totalamount * (1 + $taxrate);
echo 'Total including tax: $'.$totalamount;
?>
</Body>
</html>
--------------
Thank You
Nawaz









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.