Jump to content

Tried coding simple math application - failed ...what am I doing wrong?


jdock1

Recommended Posts

I tried making a simple app for figuring out what the customers cash tendered was  - the sale amount (I was bored, and figured my bro who owns his own business who sucks at math could use it)

 

As I said in previous posts, I am a virgin to PHP and get all my knowledge from for dummies books and other php reference books

 

The code seems valid to me, and I am not understanding why it isn't outputting what I want it to!

 

Here is the code:

 

<html>
<head><title>SaleCulator</title></head>
<body>
<form action="calculated.php" method="get">
Sale Amount:<input type="text" name="SaleAmount" \>
Cash Tender:<input type="text" name="cTender" \>
<input type="submit" value="Calculate" />
</form>
</body>
</html>
<?php
$sa = $_GET["SaleAmount"];
$ct = $_GET["cTender"];
$dif = $ct - $sa;
?>

 

& for the GET form code:

<?php
echo "$dif";
?>

 

Am I doing this entirely wrong?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.