Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.