PHP multiplication and result

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vippt
Forum Newbie
Posts: 2
Joined: Thu Jun 30, 2011 1:58 am

PHP multiplication and result

Post 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.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: PHP multiplication and result

Post 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
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
vippt
Forum Newbie
Posts: 2
Joined: Thu Jun 30, 2011 1:58 am

Re: PHP multiplication and result

Post 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.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: PHP multiplication and result

Post 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.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply