In the above example, we've specified two distinct
products with different ID numbers for the glass and plastic
versions of the Bar-B-Que sauce. Also note that we've made
the "iqty" field user-selectable so that a specific quantity
can be selected at the time of adding the item to the
basket. Another change is that with a FORM, you can have the
user add more than one item at a time with a single
selection.
Here is what the HTML looks like:
<FORM METHOD="post"
ACTION="http://order.icorp.net/mpr/mo2">
<INPUT TYPE="hidden" NAME="c_sample" VALUE="1">
<INPUT TYPE="hidden" NAME="function" VALUE="add">
ORDER:<BR>
<INPUT TYPE="hidden" NAME="item" VALUE="1000">
<INPUT SIZE=2 NAME="iqty" VALUE="0"> bottles of Bob's
Bar-B-Que Sauce (plastic bottle)
<INPUT TYPE="hidden" NAME="iunit" VALUE="1.95">
<INPUT TYPE="hidden" NAME="iname" VALUE="Bob's Bar-B-Que
Sauce (plastic bottle)">
<BR>
<INPUT TYPE="hidden" NAME="item" VALUE="1001">
<INPUT SIZE=2 NAME="iqty" VALUE="0"> bottles Bob's
Bar-B-Que Sauce (glass bottle)
<INPUT TYPE="hidden" NAME="iunit" VALUE="1.95">
<INPUT TYPE="hidden" NAME="iname" VALUE="Bob's Bar-B-Que
Sauce (glass bottle)">
<BR>
<INPUT TYPE="submit" VALUE="Add the above items to my
shopping basket">
</FORM>
Be sure to note the order in which the fields are
specified. This is important! First specify the
Vendor ID (c_xxx with a value of "1"), then the
function, followed by information on each product in
the form in the following order:
- Item/product ID ("item")
- Quantity ("iqty")
- Unit cost ("iunit")
- Name ("iname")
- Styles ("istyle") *optional
- Freight charge per unit ("ifreight") *optional
- Vendor ID ("ivendor") *optional - only used for a
multiple merchant-type store
Now, let's get fancy with some extra features. Instead
of having two different products, let's create one
line-item, with a pull-down menu where the user can specify
the "style" (either glass or plastic):

The source HTML for the above form is Here.
Now let's get even fancier using TABLES and more
products. Let's say that Bob is doing so well, he needs to
introduce more products. So he comes up with three flavors
(Original, Hickory, and Extra Hot) and three sizes (12oz,
24oz, and 44oz bottles). Let's see how we can make a simple
tabular form to handle this:
The source HTML for the above form is Here.
As you can see, there is a lot of flexibility afforded
in using FORMs - just take your time and make sure all the
data is properly specified.
NOTE that the hidden form fields can be placed
anywhere inside of the table, but they should remain listed
in the appropriate order. It is recommended that if you use
tables, insert most of the hidden fields in the first table
column - it won't have any affect on the formatting. If you
put hidden fields outside of the table rows or columns, some
browsers will not properly interpret these commands and
leave blank space at the end of the table.
Next Section: Checkout/Other
Functions
|