Dreamweaver contains many built-in tools to aid in quickly building dynamic sites. Part 1 of this series showed the Record Insertion Form Wizard to set up a simple user registration form on a web site. The registration form allows a user to register for a site. Part 2 showed validation and the user agreement, using more built-in tools of Dreamweaver and a little rudimentary JavaScript. Part 3 will show how to pass registration details to Paypal or other payment processor for a paid membership type of site. This part of the tutorial will apply to PHP, ASP, ColdFusion, JSP, and ASP.NET using some built in tools.

Payment Processing

There are basically two types of credit card processors -- gateways and processors. A gateway, like Authorize.Net, usually requires a monthly fee and a complicated script connection to an API. The gateway also usually requires that you have a merchant account and that you collect the credit card details on your site. The processor, on the other hand, is a self-contained payment collection site, like Paypal. Once you set up an account, there are usually only transaction fees. You post details of a purchase to the site, and the site will do the rest.

A payment processor like Paypal can be used to receive money for purchases, subscriptions, or gifts without setting up merchant accounts or complicated gateway scripts or being responsible for credit cards yourself -- the trusted third party site collects the credit card details and takes a small fee. In the case of Paypal, the fee is much lower than it would be if you had to deal with a gateway service. For smaller sites with lower quantities of transactions, it makes sense to use a processor.

API

Assuming you already have an account, every processor site has it's own API. You will have to download their documentation and become familiar with it. Payment processor API documents at the very minimum will show you the field names required to accept payments. Once you know the field names, you can set up a form on your site that passes the details to the payment processor.

Using Paypal as an example (other examples include Worldpay Select Junior), we'll implement a simple post using the dynamic data collected in the first two parts of this series and a specified product amount that will be charged to your end user.

Note: The Paypal help section at http://www.paypal.com/cgi-bin/webscr?cmd=_merchant-outside has loads of documentation to help you get started.

There are only a few necessary fields to sell one item or service, with user-defined values bolded:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="you@yourdomain.com">
<input type="hidden" name="item_name" value="My Great Service">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="100.00">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="submit" name="submit" value="Purchase this great service now!" />
</form>

Open or create the thankyou.php (or other server model page you created) page and add the form to it. Your user will hit this page after filling out the form from part 1 and 2 of this series. Pretty easy so far -- all you need to do is put your email address in the business field, and fill in item name/numbers and the amount.

Name/Address Information

We also want to pre-popluate the user's name/address information in the form to make it easier for the user if he doesn't have an account with the payment processor. The following fields will have to be set up dynamically using the information obtained in part 1 -- the info will come directly from the database. The fields, which will be added to the basic form above, are as follows, with values bolded:

<input type="hidden" name="first_name" value="Jack">
<input type="hidden" name="last_name" value="Splat">
<input type="hidden" name="address1" value="555 Adobe Drive">
<input type="hidden" name="address2" value="Apt 1">
<input type="hidden" name="city" value="Fairfax">
<input type="hidden" name="state" value="VA">
<input type="hidden" name="zip" value="22031">

Basically what we want to do is grab the data from the database and put it into the fields. We can do this without writing a line of code.

First, create a recordset named rsMembership using the following SQL (or using the Simple recordset dialog box and choosing each field):

SELECT MemberEmail,
MemberFirstName,
MemberLastName,
MemberAddress,
MemberAddress2,
MemberCity,
MemberState,
MemberPostalCode
FROM members

With the recordset added to the page, insert the entire form on the page, as shown previously. Expand the recordset in the Bindings panel and drag/drop each field from the bindings panel onto the individual fields on the page. Since they are hidden fields, they will show as a little shield in design view, providing your preferences are set up to show invisible elements (View > Visual Aids > Invisible Elements.) You can select each one in turn to view the field name in the property inspector (Window > Properties), as shown in Figure 1:


Figure 1: Using the bindings panel to set form field values

No coding required -- form is complete.

Conclusion

User membership or signup forms are a staple of the web, and one can be created easily in Dreamweaver using built-in tools. This three part series has shown how to add a user to the database with a form, validate the form, show a user agreement, and allow the user to make a payment to your site using Paypal.