zacthespack Posted August 15, 2011 Share Posted August 15, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/244823-multiplying-fields-and-then-adding-the-results/ Share on other sites More sharing options...
Adam Posted August 15, 2011 Share Posted August 15, 2011 Some code might help. What have you actually tried so far? Quote Link to comment https://forums.phpfreaks.com/topic/244823-multiplying-fields-and-then-adding-the-results/#findComment-1257629 Share on other sites More sharing options...
zacthespack Posted August 15, 2011 Author Share Posted August 15, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/244823-multiplying-fields-and-then-adding-the-results/#findComment-1257631 Share on other sites More sharing options...
Adam Posted August 15, 2011 Share Posted August 15, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/244823-multiplying-fields-and-then-adding-the-results/#findComment-1257634 Share on other sites More sharing options...
zacthespack Posted August 15, 2011 Author Share Posted August 15, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/244823-multiplying-fields-and-then-adding-the-results/#findComment-1257638 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.