A script I'm working on, takes values from a form in page1. These values are sent to page2, where the user can input a complex mathematical equation operating upon these values.
Page1:
Length: [TEXT BOX]
Width: [TEXT BOX]
Heigth: [TEXT BOX]
..
..
Page2:
Equation: 50+((length)+4(width)-(4height)))... and so on..
I named the variables and used ereg_replace to get the values of these variables into the equation. That is, when the user enters "length" and hits submit, its the value of "length", ie "$length" that gets inserted. That leaves me with a string of this nature (considering length=5):
50+((5)+...)
If I use intval() on this string, the operators get dropped, and I end up with '50'. How do I make the math operators operate at runtime, so that '50+(5)' is actually 55?
Thanks for any input.