JKetelaar 1,078 Report post Posted January 5, 2013 A simple tutorial <!-- This is the HTML part --> <html> <head><title>Simple PHP Calculator made by ParaDox</title></head> <body> <!-- For this calculator we will use post --> <form method="post"> <!-- Here we make a form for our first number and we call it "firstnum" --> First number: <input type="text" name="firstnum"> <br> <!-- Here we make a dropdown box for the sort of operator --> Sort operator: <select name="operator"> <option>+</option> <option>-</option> <option>*</option> <option>/</option> </select> <br> <!-- Here we make a form for our second number and we call it "secondnum" --> Second Number: <input type="text" name="secondnum"> <br> <!-- Here we make our button to let the calculator do his job and we call the button "Calculate" --> <input type="submit" name="calculate" value="Calculate"> </form> </body> </html> <!-- Now the PHP part --> <!-- Well this is easy to understand I think, LOL --> <?php $first=$_POST['firstnum']; $second=$_POST['secondnum']; $operator=$_POST['operator']; if ($operator=="+") {$total=$first + $second;} if ($operator=="-") {$total=$first - $second;} if ($operator=="*") {$total=$first * $second;} if ($operator=="/") {$total=$first / $second;} echo $total; ?> Quote Share this post Link to post Share on other sites
motordog 1 Report post Posted January 18, 2013 paradox how are u such a pro man i need to learn how to script Quote Share this post Link to post Share on other sites
JKetelaar 1,078 Report post Posted January 19, 2013 paradox how are u such a pro man i need to learn how to script lol Quote Share this post Link to post Share on other sites
Tomppa 0 Report post Posted January 20, 2013 nice tutorial Quote Share this post Link to post Share on other sites
Hakuna 70 Report post Posted January 23, 2013 Wow? Never knew you could make calculators with PHP coding lol. Awesome! LOL. Quote Share this post Link to post Share on other sites
Parameter 20 Report post Posted January 24, 2013 Wow? Never knew you could make calculators with PHP coding lol. Awesome! LOL. Quote Share this post Link to post Share on other sites
darkdevil 4 Report post Posted January 24, 2013 Quote Share this post Link to post Share on other sites
JKetelaar 1,078 Report post Posted January 24, 2013 Quote Share this post Link to post Share on other sites
Instructions 7 Report post Posted January 26, 2013 Lol you guys pickin' on meh Quote Share this post Link to post Share on other sites
Holy 4 Report post Posted June 30, 2013 thanks mah dude Quote Share this post Link to post Share on other sites
Matthijs 0 Report post Posted July 2, 2013 Wtf, that is fucking amazing! Quote Share this post Link to post Share on other sites
Banked 0 Report post Posted August 30, 2014 You forgot to add where is answer goes. Quote Share this post Link to post Share on other sites