Jump to content

form calculator in php?


NickG21

Recommended Posts

hey everyone i was just wondering if anyone had ever constructed a calculator in php.  i looked through multiple examples online and found only very basic calculators.
what i am looking to do is make a form with three input boxes.....
List Size
Message Size
Mail Sent Per Week.

Depending on the values entered i want to do calculations and redisplay the prices in 6 different textboxes.  3 for an enterprise edition and 3 for a professional edition.
here is a beginning of the code i am looking at but i already am unsure how to handle the input.  maybe a select case??
any help is appreciated.
thank you

[code]if(isset($_POST['submit']))
{
$ListSize = $_POST['ListSize'];
$MessageSize = $_POST['MessageSize'];
$MailSent = $_POST['MailSent'];
$ProfListOnly = $_POST['ProfListOnly'];
$ProfTotal = $_POST['ProfTotal'];
$EntListOnly = $_POST['EntListOnly'];
$EntTotal = $_POST['EntTotal'];
$Bandwidth = $_POST['Bandwidth'];

if(intval($ListSize) <= 2000){
$EntTotal = "$45";
$EntListOnly = "$45";
else if(intval($ListSize) <= 3000){
        $EntTotal = "$60";
and so on and so forth......
}
}



?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/35672-form-calculator-in-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.