Hack 49 Put Both Cart Buttons in One Form 
Overcome the limitations of some web
development tools by combining the Add to Cart and View Cart buttons
into a single HTML form.
If you're using a web
page editor that prefers or allows pages to contain only one form
(such as some versions of Dreamweaver), or if you're
a Microsoft .NET programmer, you might need to combine both Shopping
Cart buttons into a single web form.
Fortunately, PayPal relies on the names of the buttons, not on the
post URL or other details of the HTML form, to correctly interpret
the buttons.
5.6.1 The Code
To implement this single-form design, simply include two submit
buttons in the PayPal cart form. Name one button
add and the other button
display, like this:
<form method="post" action="https://www.paypal.com/cgi-bin/webscr"
target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="pay@biz.com">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="hidden" name="amount" value="19.95">
<input type="submit" name="add" value="Add to Cart">
<input type="submit" name="display" value="Display Cart">
</form>
Naturally, this form accepts the additional fields and other
customization afforded by the other hacks in this chapter.
5.6.2 The Right Tools for the Right Job
If you use an HTML editor such as Microsoft FrontPage or Macromedia
Dreamweaver to create your web pages, you should consider trying out
one of the PayPal plug-ins available for those tools. These plug-ins
integrate right into the tool and can be called up while
you're editing your pages. They step you through
creating the button and then automatically insert the HTML into your
web page.
Here are some links to plug-ins for popular page editors. Most of
them are offered by third parties who have worked closely with PayPal
to make sure they work properly:
- Macromedia Dreamweaver
-
http://www.webassist.com/Products/ProductDetails.asp?PID=18
- Microsoft FrontPage
-
http://www.auctionmessenger.net/paypal
- Adobe GoLive
-
http://www.transmitmedia.com/golive/paypal
- NetObjects Fusion 7.0 and higher (with built-in PayPal module)
-
http://www.netobjects.com
|