Log in

View Full Version : Resolved Help with Math in php/html page



Dirt_Diver
01-03-2009, 05:44 PM
I have a website that I am working on for one of our companies and I need to do some simple math within the page and have it return some results.

Here is the page:
http://www.salmipropertyholdings.com/mao.php

What I'm trying to do is have the user input the
House Price (HP):
After Repair Value (ARV):
Percent:
and the repair costs (RC):

then I want the page to do the math and return the results in the MAO box.

The formula I need is: ARV x Percent - RC = MAO

I don't know how to right the code or input it into a database if I need too so I was wondering if someone could help me or get me on the right track to find out how to do this.
I see bank sites do things like this all the time but never really thought about how it was done until now.

bluewalrus
01-03-2009, 06:59 PM
something like this then echo $value into mao as a text field area (of course all values would have to be entered correctly this doesn't test the entered information to make sure it is correct).

<?php
$price = $_POST['House_Price'];
$arv = $_POST['ARV'];
$percent = $_POST['percent'];
$rc = $_POST['Repair_Costs'];
$value = ($arv * $percent) - $rc;
?>

JasonDFR
01-06-2009, 06:45 PM
You should post this question in the javascript forum. Javascript would be perfect for doing something like this.