parsing values from a form post

From: Date: Fri, 08 Apr 2005 16:52:09 +0000
Subject: parsing values from a form post
Groups: php.general 
Request: Send a blank email to php-general+get-212652@lists.php.net to get a copy of this message
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

« previous php.general (#212652) next »