开发者

PHP calculator script

I've been looking all over for 开发者_开发百科a sample script, but I haven't been able to find one. Basically, I want to have the code get a value from a div and multiply that number based on the user input. For example, if I have a site for recipes, and I want to have a calculator where the user enters the amount of servings that they need, and it'll change the recipe to give the amount of servings specified. (you can see an example HERE.)


you have to use $_POST or $_GET

To get the users input.

Then you can manipulate it according to your needs and then display it back to the users using echo


i think you can solve the problem with Javascript too ! if you are using PHP then do like this

if (isset($_POST['num1'],$_POST['num2'],$_POST['operator']))
{
 ...
}

if you do not use ISSET it will show warnings that $_POST is undefined or so...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜