So I have a simple site that is using php to do some simple math like so:
<form action="" method="POST">
<input type="text" name="first" />
<select name="method">
<option>+</option>
<option>_</option>
<option>*</option>
<option>/</option>
</select>
<input type="text" name="second" />
<input type="submit" value="Equals" />
The site lets the user inputs two numbers and then select a math operator to manipulate them by. So for example in the first input, the user could enter the number 3, select the subtraction operator, enter the number 1 in the next field and submit. I process the information like so:
if (isset($_POST['first']) && isset($_POST['second'])) {
$first = $_POST['first'];
$second = $_POST['second'];
$method = $_POST['method'];
}
However, I want to echo the result of the math problem on webpage after submitting. How would I do this? Just echoing all the variables would just give me (in this case) "3-1" instead of the actual answer which would be "2".
Any idea how would accomplish this?