Page 1 of 1

PHP multiplication and result

Posted: Thu Jun 30, 2011 2:10 am
by vippt
Hello all,

I´m not sure if i´m on the right place to post this, i´m sorry if not.

I need some help with a php script i´m not good with php but can make few small things.

What i´m looking for is a calculator " form " that has a fixed value when someone insert a value it should multiply that value over a fixed value.
My main problem is that the fixed value can chnage some times, so i need a option to change that value from a "admin" secction where i can protect that page with a password.

An example how it should work is: 25 * "fixed value 235" = 5.875
Someone entred the value 25 and it should show the result over the fixed (hiden) value.

Sorry for my bad English, thank you all.

Re: PHP multiplication and result

Posted: Thu Jun 30, 2011 2:36 am
by social_experiment
keywords=login+script
You can search through the forum under the "Security" thread, this topic (login / securing pages) has been covered quite a few times

Re: PHP multiplication and result

Posted: Thu Jun 30, 2011 2:47 am
by vippt
social_experiment wrote:keywords=login+script
You can search through the forum under the "Security" thread, this topic (login / securing pages) has been covered quite a few times
This is not a login / security script, i know how to protect a page, but i dont know how to make the calculator and show the results.

Thank you for the reply.

Re: PHP multiplication and result

Posted: Thu Jun 30, 2011 6:57 am
by social_experiment
vippt wrote:My main problem is that the fixed value can chnage some times, so i need a option to change that value from a "admin" secction where i can protect that page with a password.
Ah ok, sorry my english is a bit rusty.
vippt wrote:but i dont know how to make the calculator and show the results.
The calculator is relatively easy : 1 form which accepts user input, 1 script to process user input.

Code: Select all

<?php
 // simplified version of what you need
 $userInput = $_POST['userInput'];
 $fixedValue = 235;

 $answer = $userInput * $fixedValue; 
 echo $answer;
?>
Things i didn't do in the script include (but is not limited to) : Checking what type of data you receive, checking that the page was submitted via the button on the form.