Stacking Variables on the Form

### Index Up << >>

## Stacking Variables on the Form

Many MiniVend variables can be ``stacked'', meaning they can have multiple values for the same variable name. As an example -- to allow the user to order multiple items with one click, you can set up a form like this:

     <FORM METHOD=POST ACTION="[process-order]">
     <input type=checkbox name="mv_order_item" value="M3243"> Item M3243
     <input type=checkbox name="mv_order_item" value="M3244"> Item M3244
     <input type=checkbox name="mv_order_item" value="M3245"> Item M3245
     <input type=hidden name="mv_doit" value="refresh">
     <input type=submit name="mv_junk" value="Order Checked Items">
     </FORM>

The stackable `mv_order_item` variable with be decoded with multiple values, causing the order of any items that are checked.

To place a ``delete'' checkbox on your shopping basket display:

     <FORM METHOD=POST ACTION="[process-order]">
     [item-list]
       <input type=checkbox name="[quantity-name]" value="0"> Delete
       Part number: [item-code]
       Quantity: <input type=text name="[quantity-name]" value="[item-quantity]">
       Description: [item-description]
     [/item-list]
     <input type=hidden name="mv_doit" value="refresh">
     <input type=submit name="mv_junk" value="Order Checked Items">
     </FORM>

In this case, first instance of the variable name set by `[quantity-name]` will be used as the order quantity, deleting the item from the form.

Of course, not all variables are stackable. Check the documentation for which ones can be stacked -- or experiment on your own.

### Index Up << >>