Jump to content

PHP Calculation Help


nathgregory

Recommended Posts

Hi,

I have an itinerary form at http://www.happydaysremovals.com/estimate.html

Customers fill this in, and it uses phpmailer-fe to email the results to myself. I use a HTML .tpl file so I can make the output email look as I want.

All that is fine, but I would like a volume calculator.  Next to each item on the form, the customer enters the amount of that item, usually 1 or 2.  If it was say a setee, I want to define that a setee = 30 cubic feet, for example.  Then I want the calculator to calculate the total cubic footage for all the variables, and include it in the html email.

 

I know with javascript this can be done, but I was hoping for a PHP result and for it to somehow work in with phpmailer-fe, for example:

 

</style>

<script language="JavaScript">

  function write_this()

{

var setteelarge;

var setteemedium;

var setteesmall;

 

var setteelarge2;

var setteemedium2;

var setteesmall2;

 

var setteelargeresult;

var setteemediumresult;

var setteesmallresult;

 

var total;

 

setteelarge = document.form1.LargeSettee.value;

setteemedium = document.form1.MediumSettee.value;

setteesmall = document.form1.SmallSettee.value;

 

setteelarge2 = 45

setteemedium2 = 31

setteesmall2 = 22

 

setteelargeresult = (setteelarge * setteelarge2);

setteemediumresult = (setteemedium * setteemedium2);

setteesmallresult = (setteesmall * setteesmall2);

 

total = (setteelargeresult+setteemediumresult+setteesmallresult)

 

document.form1.Total_Cubic_Feet.value = total

}

  </script>

 

Basically, I want to be able to include the cubic feet total value to also be emailed to me in the HTML email, but preferably all in PHP.

 

At the moment, I get everyones itinerary, but want to be automatically be able to work out the cubic footage.

 

Thanks

Link to comment
Share on other sites

Have you tried to write any php code? Or do you want people to write that for you? Keep in mind though php is a server side language. So any calculation you php do happens on the server and after that it outputs it to the browser. If you want stuff to be calculated client side, you require either something like javascript or flash or other fancy clientside stuff.

btw I Moved this forum to the php coding forum, instead of the html one

Link to comment
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.