function cpo_multi_product_form($products)
{
    if (!is_array($products)) {
        return false;
    }
    $paypal_options = get_option('cpo_settings');
    if (!is_array($paypal_options)) {
        return false;
    }
    // gather the data needed for the form and put it into arrays for the html output functions
    // gather up the hidden form elements into one array
    if (isset($paypal_options['action']) && $paypal_options['action'] != '') {
        $form_action = $paypal_options['action'];
        unset($paypal_options['action']);
    } else {
        return false;
    }
    $hidden_form_inputs = $paypal_options;
    foreach ($products as $prod_index => $prod) {
        $product_data = get_post_meta($prod->ID, '_cpo_product_data', true);
        if ($product_data) {
            $product_name = get_the_title($prod->ID);
            $hidden_form_inputs['item_name'] = $product_name;
            $hidden_form_inputs['item_number'] = $product_data['item_number'];
            $hidden_form_inputs['shipping'] = $product_data['shipping'];
            $hidden_form_inputs['shipping2'] = $product_data['shipping2'];
            if ($product_data['price']) {
                $hidden_form_inputs['amount'] = $product_data['price'];
            }
            // set up the product options data if we have a group_label
            if ($product_data['option_group_label']) {
                // need a label for the options for the PP form to work
                // put all the needed data for the product options into an array
                $option_group_label = $product_data['option_group_label'];
                // add the hidden data to the $hidden_form_inputs
                $hidden_form_inputs['on0'] = $option_group_label;
                $product_options = $product_data['product_options'];
                // check to see if there is a price set for the first option index.
                // if the price is set we will be building an option/price index in the next foreach loop
                if ($product_options[0]['price']) {
                    $hidden_form_inputs['option_index'] = 0;
                }
                // loop through product_options to remove empty fields
                foreach ($product_options as $index => $option) {
                    if (!$option['label']) {
                        unset($product_options[$index]);
                        continue;
                    }
                    // create an array for use in the html helper function
                    $html_select_options[$index]['value'] = $option['label'];
                    $html_select_options[$index]['text'] = $option['label'] . ' inches';
                    // if we have a price then we need to add hidden inputs to relate the option labels to the prices in paypal
                    if ($option['price']) {
                        $select_index_label = 'option_select' . $index;
                        $amount_index_label = 'option_amount' . $index;
                        $label = $option['label'];
                        $amount = $option['price'];
                        $hidden_form_inputs[$select_index_label] = $label;
                        $hidden_form_inputs[$amount_index_label] = $amount;
                        // append the price to the html select options
                        $html_select_options[$index]['text'] .= ' - $' . $option['price'];
                    }
                    // set the first option to be the selected option in the form
                    if ($index == 0) {
                        $html_select_options[$index]['selected'] = true;
                    }
                }
            }
            // end of the data setup
            ?>
<form target="paypal" action="<?php 
            echo $form_action;
            ?>
" method="post">
<?php 
            print_input_hidden($hidden_form_inputs);
            ?>
<tr <?php 
            if ($prod_index == 0) {
                echo ' class="first"';
            }
            ?>
>
<td>
<h4><?php 
            echo get_the_title($prod->ID);
            ?>
</h4>
<p class="product-sub-text"><?php 
            echo $product_data['sub_text'];
            ?>
</p>
</td>

<td>
<?php 
            // if we have options set for this product
            if ($product_data['option_group_label']) {
                // need a label for the options for the PP form to work
                $html = new html_helper();
                echo '<p>' . $product_data['option_group_label'] . '</p>';
                echo $html->select('os0', $html_select_options);
            } else {
                // we just have a product display the price
                echo '<p>$' . $product_data['price'] . '</p>';
            }
            ?>
</td><td>
<?php 
            $quantity_label = $product_data['quantity_label'];
            if ($product_data['quantity_units']) {
                $quantity_label .= ' (' . $product_data['quantity_units'] . ')';
            }
            ?>
<p class="quantity-label"><?php 
            echo $quantity_label;
            ?>
:</p>

<?php 
            print_quantity_field($product_data['min_quantity']);
            ?>

</td><td>

<?php 
            print_submit("Add to Cart", $product_name);
            ?>

</td>

</tr>
</form>
            <?php 
        }
        // end if $product_data
    }
}