I like to solve a mathematical formula passed via post. eg.:
<form name="form1" method="post" action="">
<label for="f">Fórmula: </label>
<input type="text" name="f" id="f" value="<?=$_POST['f']?>">
<input type="submit" name="button" id="button" value="Submit">
</form>
$f = $_POST['f']; //Suppose the user typed: (A + B) * C as formula
Using this formula passed via $_POST
(A + B) * C and do the mathematical calculus
A = 1; B = 2; C = 3;
$x = (A + B) * C // here the formula would be
$_POST[f] = (A + B) * C
echo $ x;