Jump to content

REQ: some sort of calc


dastylex

Recommended Posts

hi

im looking for some sort of php calculator...

like:

if i enter some value (suppose X value) into it.. it calculates 15% of that X value and add the result into X value..

 

for example..

X value = 230

it calculates like this 230 x 15% = 34.5

and it adds it back to X value.. in this case...

34.5 + 230 = 264.5

 

 

final result it must show is 264.5

 

nothing is to be changed.. only X value is variable and has to be changed everytime i want to calculate.

 

can u help me please? i want it urgent.

thanks

bye

Link to comment
https://forums.phpfreaks.com/topic/90213-req-some-sort-of-calc/
Share on other sites

<tr>
                <td colspan="2"><table width="100%" border="3" cellpadding="15" cellspacing="0">
                    <tr>
                      <td width="" valign="top" ><div align="center"><strong>Calculate Percent with this Percent Formula:
                            <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
                            </script>
                      </strong>
                        <SCRIPT LANGUAGE="JavaScript" type="text/javascript">function findpercent(form) {
a = form.percentin.value/100;
b = a*form.numberused.value;
form.numberanswer.value = b;
}
              </script>

                          <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
function calculatepercent(form) {
a = form.numberin.value;
b = form.numberintwo.value;
c = a/b;
d = c*100;
form.answer.value = d;
}
              </script>

                        </div>
                        <form action="calculate-percent-with-percentage-calculator.php" name=form1>
                          <p></p>
                          <p align="center">
                            <input name="percentin" type="text" class="regfont" size=6>
                            % (Percent) of
                            <input name="numberused" type="text" class="regfont" size=5>
                            is:
                          <p align="center">

                            <input type=button onClick="findpercent(this.form)" value="Calculate Percent">
                          <p align="center"> <strong>CALCULATION result: </strong>
                            <input name="numberanswer" type="text" class="regfont"
size=10>
                          </p>
                        </form></td>
                    </tr>
                  </table>
                   </td>

              </tr>
            </table></td>

 

i got this coding from some website.. it allows to calculate the percentage of the number.. but i want to modify it so it adds up the value with the answer of percentage.

im totally a noob in programming.. so kindly.. if u can get me somthing?

thanks

Link to comment
https://forums.phpfreaks.com/topic/90213-req-some-sort-of-calc/#findComment-463922
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.