I am trying to get the value of $result
but it gives 2+4
as I am giving values $first=2
, $second=4
and $operation= +
.
<?php
$first = $_REQUEST['first'];
$second = $_REQUEST['second'];
$operation = $_REQUEST['operation'];
echo $result = "$first+$operation+$second";
?>
<form id="dpk-form" action="" method="post">
<label>First No:</label> <input name="first" type="text" /><br /><br />
<label>Second No:</label> <input name="second" type="text" /><br /><br />
<label>Operation:</label> <input name="operation" type="text" /><br /><br />
<input type="submit" value="Submit" /><br /><br />
<label>Result:</label> <input name="result" type="text" /><br />
</form>