Jump to content

Multiplying fields and then adding the results


zacthespack

Recommended Posts

I am setting up a order form on my website http://www.acehireltd.co.uk/orderform/ , I have been able to pretty much set everything up including auto complete and adding space for another product when you check a box etc. However there is one last thing I need to do which I just cant work out.

Each product has a price that gets auto filled from a mysql datebase when the user enters the products name or code, the user must the enter a  quantity of how many of that product they want. I need the price and quantity field to be multiplied together an the result of this displayed in another field on the form (e.g called total product price).

I also then at the bottom of the form need a complete total price to be worked out by adding all the total product prices as well as the delivery cost field.

I hope someone can help.

Thanks you.

Some code might help. What have you actually tried so far?

 

I had yet to find anything suitable but after more research I think it will have to java script, if i found some and tried with this could i still post it here and would you beable to help fix anything if needed?

Yes you'll need to use JavaScript to dynamically update the totals without reloading the page. I would only use it to display a total though, not actually post it to the handling PHP code. Otherwise users you could just inject or change the input to whatever they want. If you run into problems by all means post it here, but include the erroneous code and explain the problem.

 

By the way I had a quick look at your order form, and adding products to it confused the hell out of me. I got a code ("HE0510") and entered it into the text box, a loading graphic was displayed but nothing happened? Am I supposed to enter the details in myself?

Yes you'll need to use JavaScript to dynamically update the totals without reloading the page. I would only use it to display a total though, not actually post it to the handling PHP code. Otherwise users you could just inject or change the input to whatever they want. If you run into problems by all means post it here, but include the erroneous code and explain the problem.

 

By the way I had a quick look at your order form, and adding products to it confused the hell out of me. I got a code ("HE0510") and entered it into the text box, a loading graphic was displayed but nothing happened? Am I supposed to enter the details in myself?

 

OK i have opened a topic on the javascript part of the forum if you look there it will have to code and whats happening now.

http://www.phpfreaks.com/forums/index.php?topic=341541.0

 

when your type in a code it should then bring up a drop down list of all the codes that include what you have enter, you then click that and it should the auto fill the code, description and price field.

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.