/ Published in: PHP

Very basic dont judge!
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php { $sum1 = $_POST['sum1']; $sum2 = $_POST['sum2']; function add($sum1,$sum2) { $answer = $sum1 + $sum2; { return 'Please enter a number nob!'; } echo $sum1 . ' + ' . $sum2 . ' = ' . $answer; } echo add($sum1,$sum2); } ?> <form method="post" action="#"> <input type="text" name="sum1" value="" /><br /> <input type="text" name="sum2" value="" /><br /> <input type="submit" name="submit" value="Add" /> </form>
Comments
