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?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.