I wanted the math operation to be done directly from the form post value. Is there a function to accomplish this? I tried this, but it just echo's out the input value as it is:
<form action="" method="post">
<input type="text" name="equation" value="2+(3+4)">
<input type="submit" value="Calculate">
</form>
<?php
if(isset($_POST['equation'])){
$equation = htmlspecialchars($_POST['equation']);
echo $equation;
}
?>
As you see, i like to get the output of 2+(3+4) while echo the $equation.