[simple calculator program] HTML page does not refresh to the result php page

I wrote simple calculator program with a html page and a php page.
Here is the html code: calculator.php

<html>
<head>
<title>My Calculator</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
</head>

<body>
<form action"result.php" method="post">
<table width="400px" border="0px">
<tr><td>The First Number</td><td><input type="text" name="num1"/</td></tr>
<tr><td>The Second Number</td><td><input type="text" name="num2"/</td></tr>
<tr><td>Operator</td>
<td>
<select name="oper">
<option value="+">+</option>
<option value="-">-</option>
<option value="*">*</option>
<option value="/">/</option>
</select>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Calculatioin result"/></td>
</tr>
</table>
</form>
</body>
</html>

and here is my php page: result.php
[php]

<?php $num1=$_REQUEST['num1']; $num2=$_REQUEST['num2']; $oper=$_REQUEST['oper']; $result=0; switch($oper) { case "+": $result=$num1+$num2; break; case "-": $result=$num1-$num2; break; case "*": $result=$num1*$num2; break; case "/": $result=$num1/$num2; break; default: echo 'The operator is incorrect.'; } echo 'The result is: '.$result; ?>

return to the calculator page
[/php]

The problem is, when I ran the html page in browser, the html page does not go any where after I clicked on “calculation result” button.

Please help me to solve this problem.
Thanks!

should be action="result.php" ..

I am not a senior developer in PHP and I advise you next time to write your code as PHP

Sponsor our Newsletter | Privacy Policy | Terms of Service