Re: Maths Problem
| From: | mike cullerton | Date: | Wed, 17 Apr 2002 14:01:26 +0000 |
| Subject: | Re: Maths Problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93324@lists.php.net to get a copy of this message | ||
On Wednesday, April 17, 2002, at 02:46 AM, Meredith-Wilks, Richard wrote:
if the form is using a text field for the user to type in the formula, you'll need to check the data you receive to make sure it's valid. after that, you might be able to use 'eval'. http://www.php.net/manual/en/function.eval.phpHi, I have a maths question. I'm trying to create a html form where a user can enter formula in an input box (e.g. '$a + $b - 10') and posts it to PHP. The variables $a and $b are known but the formula can be changed on the form (e.g. '$a / $b * 2'). I want PHP to take the text input, the formula and calculate the result and display the results.