Why my php program is not calculating right?

  • Thread starter Thread starter Hello
  • Start date Start date
H

Hello

Guest
This is my HTML code which i am using to fill up the request to my php but i am not getting neither the OS or amount of money

<html>
<head>
<title>SaveTheWorld Software</title>
<link rel ="stylesheet" type="text/css" href="sample.css" />
</head>

<body>
<h1>SaveTheWorld: Order Form</h1>
<p>To order <strong>SaveTheWorld</strong>, please complete the following order form: </p>

<p>
<form action = "softwareOrder.php" method = "post" >

<table>
<tr>
<td>Choose your operating system:</td>
<td><select name = "os">
<option>Linux</option>
<option>Macintosh</option>
<option>Windows</option>
</select></td>
</tr>
<tr>
<td>Number of copies:</td>
<td><input type = "text" size = "5" name = "numCopies" /></td>
</tr>
</table>
<p>
<input type = "submit" value = "Submit Your Order" />
</p>
</form>
</body>
</html>

This is my php code:
<html>
<head>
<title>SaveTheWorld Software</title>
<link rel ="stylesheet" type="text/css" href="sample.css" />
</head>
<body>

<h1>Your Order</h1>
<?php
$os = $_POST['os'];
$numCopies = $_POST['numCopies'];

$subTotal = numCopies * 35;
$tax = $subTotal * .07;
$shipping = numCopies * 1.25;
$total = $subTotal + $tax + $shipping;

print("<p>Your Operating System is $os.</p>");

print("<p>Number of copies: $numCopies and you total is $$total.</p>");

?>

</body>
</html>

what am i doing wrong? i am just a beginner - please help me!!
 
Back
Top