Обрабатывайте несколько кнопок отправки с различными действиями в PHP.
<?php extract($_POST); //do addition and store the result in $res if(isset($add)) { $res=$fnum+$snum; } //do subtraction and store the result in $res if(isset($sub)) { $res=$fnum-$snum; } //do multiplicatio and store the result in $res if(isset($mult)) { $res=$fnum*$snum; } ?> <html> <head> <title>Display the result in 3rd text box</title > </head> <body> <form method="post"> <table align="center" border="1"> <Tr> <th>Result</th> <td><input type="text" value="<?php echo @$res;?>"/></td> </tr> <tr> <th>Enter first number</th> <td><input type="text" name="fnum"/></td> </tr> <tr> <th>Enter second number</th> <td><input type="text" name="snum"/></td> </tr> <tr> <td align="center" colspan="2"> <input type="submit" value="+" name="add"/> <input type="submit" value="-" name="sub"/> <input type="submit" value="*" name="mult"/> </tr> </table> </form> </body> </html>