parsing values from a form post

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Here is an example of what could be posted from a form:
Array
(
    [tax0] => GST
    [amount0] => 10.23
    [type0] => Goods
    [tax1] => GST
    [amount1] => 6.5
    [type1] => Goods
    [tax2] => HST
    [amount2] => 3.54
    [type2] => Goods
    [tax3] => HST
    [amount3] => 8.95
    [type3] => Hotel
    [tax4] => GST
    [amount4] => 44.5
    [type4] => Goods
)

I need to be able to break out the tax, amount and type that were entered on each line of a form and then apply calculations and do database inserts on each. As you can see what I need is in sets of three denoted by the integer at the end (tax0, amount0, type0, tax1 etc.)

I can't figure out how to separate these variables and values so that I can do what I need to do.

I've got
foreach($_POST as $var=>$value) {

}
but can't seem to figure out what to do inside.

Ideas??

Thanks Chris

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux