Msg#: 3878475 posted 2:47 pm on Mar 25, 2009 (gmt 0)
Hello all im new to the forum and kind of new to php im trying to do this but cant figure out how
i have a page with a dynamic form wich extracts info from a table
id title price
on the form i have a repeat all which will display the title, price and id of each item, and a text box which i added id= <?php $id; ?> and also the internal name this text box will ask the user for an amount what i need to do is that this amount be multiply by the price and then do a sum of all of it, i have manage to show the amount in a $_POST[$id] but i have no idea how to do the multiplication and then the sum, i donīt need to save the data from the post in a database just show the person that is using this what he has to pay if he adds X amounts of products, i was thinking on using arrays but im still to new to php trying to learn any helps is appreciated
Msg#: 3878475 posted 5:46 pm on Mar 25, 2009 (gmt 0)
You need to save your item id, and your item amount(which the user enters) in an array. Then loop through the array, find the price for each item (using a query with the item id stored), and then multiply that with the amount - also stored in the array.
Msg#: 3878475 posted 5:53 pm on Mar 25, 2009 (gmt 0)
thanks for the replays on the math part i have no problems what i dunno how to do is save the variable in the post (amount) in an arrays and then do the amount*price thing for each element of the array any tips?