jdock1 Posted April 8, 2009 Share Posted April 8, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/153113-tried-coding-simple-math-application-failed-what-am-i-doing-wrong/ Share on other sites More sharing options...
Daniel0 Posted April 8, 2009 Share Posted April 8, 2009 Move <?php $sa = $_GET["SaleAmount"]; $ct = $_GET["cTender"]; $dif = $ct - $sa; ?> to the other page and then read the manual to figure out why it has to be so Quote Link to comment https://forums.phpfreaks.com/topic/153113-tried-coding-simple-math-application-failed-what-am-i-doing-wrong/#findComment-804268 Share on other sites More sharing options...
jdock1 Posted April 8, 2009 Author Share Posted April 8, 2009 Move <?php $sa = $_GET["SaleAmount"]; $ct = $_GET["cTender"]; $dif = $ct - $sa; ?> to the other page and then read the manual to figure out why it has to be so Oh thanks bro Quote Link to comment https://forums.phpfreaks.com/topic/153113-tried-coding-simple-math-application-failed-what-am-i-doing-wrong/#findComment-804868 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.