MinosTheNinth

msg:4502481 | 2:11 pm on Oct 1, 2012 (gmt 0) |
In this case i would use for cycle instead of foreach. $arrSize = count($_POST['amm']); for($i = 0; $i < $arrSize; $i++) { $bev = $_POST['alc'][$i]; $amm = $_POST['amm'][$i]; echo $bev, ' -- ', $amm, '<br>'; } This should work, but I can't test it right now. For your future projects, it would be better to use an database.
|
paor

msg:4502561 | 4:42 pm on Oct 1, 2012 (gmt 0) |
Thank you very much! Your code works very well, but I need the total amount for each type of beverage... like: beer--7.60 juice--6.62 whiskey--1.72 wine--1.21 votka--0.34 (Data is coming from the form and are only for temporary purposes) Tnx
|
MinosTheNinth

msg:4502936 | 1:01 pm on Oct 2, 2012 (gmt 0) |
Is there any given set of predefined drinks, or is it variable by input from the form?
|
paor

msg:4503009 | 2:50 pm on Oct 2, 2012 (gmt 0) |
It's variable by input from the form...meanwhile...problem is solved creating temporary_table and then fetching data $arrSize = count($_POST['pov']); for($i = 0; $i < $arrSize; $i++) { $amm = $_POST['pov'][$i]; $bev = $_POST['xxx'][$i]; $in="INSERT INTO Sales (pov, xxx) VALUES ('$amm', '$bev')"; mysql_query ( $in ) or ( "Error " . mysql_error () ) ;} $result = mysql_query("SELECT pov, xxx, SUM(pov) FROM Sales GROUP BY `xxx`");etc... MinosTheNinth thank you very much once again!
|
MinosTheNinth

msg:4503016 | 3:03 pm on Oct 2, 2012 (gmt 0) |
Wow, clever solution. I have thinking of some solutions in advance but this even crossed my mind. Thank you for the idea :) I'm glad, that finally i was able to actually help someone here.
|
|