Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn and Microsoft Windows.

Putting text around a Paypal button?

I have added a Paypal button to my weblog but I can't figure out how to put the text above or below the buy now button so that people know that they are buying before they click on it. I am just learning about HTML?


Dave's Answer:

Glad to hear that you're joining the world of ecommerce and I appreciate the simplicity and reliability that Paypal offers - heck, I use it too, on this site - and I also understand your challenges with integrating the Paypal buttons into your existing site design.

So let's dig into this a bit...

First off, let me grab one of the buttons off my Buy Dave A Chai page (where you can thank me for my free efforts on this site by buying me a nice warm spiced tea, or two!). The button looks like this:

That's not too unattractive, but let's have a look at the code underneath it, shall we?

<form name='_xclick' action='https://www.paypal.com/cgi-bin/webscr' 
   method='post'>
<input type='hidden' name='cmd' value='_xclick' />
<input type='hidden' name='currency_code' value='USD' />
<input type='hidden' name='item_name' value='Buy Dave a chai' />
<input type='hidden' name='no_shipping' value='1' />
<input type='hidden' name='rm' value='2' />
<input type='hidden' name='cbt' value='Return to Ask Dave Taylor!' />
<input type='hidden' name='amount' value='4.50' />
<input type='submit' value="Buy Dave a grande soy chai: $4.50" />
</form>

This is rather intimidating, so I can understand your reticence when it comes to getting it working on your page, but here's the secret: HTML forms lay out exactly like a <div> block does (or, if you're an old school HTML coder, a <p> block).

With this knowledge, you should be able to see that you can drop a form into a table element and then use other cells of the table to put text around the button (or, even better, have the form and the additional text all in the table, but have the begin and end <form> tag outside the table for even easier layout).

For example, if I wanted to tuck some small print immediately below the button, it might look like this:

<form name='_xclick' action='https://www.paypal.com/cgi-bin/webscr' 
   method='post'>
<input type='hidden' name='cmd' value='_xclick' />
<input type='hidden' name='currency_code' value='USD' />
<input type='hidden' name='item_name' value='Buy Dave a chai' />
<input type='hidden' name='no_shipping' value='1' />
<input type='hidden' name='rm' value='2' />
<input type='hidden' name='cbt' value='Return to Ask Dave Taylor!' />
<input type='hidden' name='amount' value='4.50' />
<center>
<input type='submit' value="Buy Dave a grande soy chai: $4.50" />
<div style="font-size:60%">Dave's surprisingly thirsty right now!</div>
</center>
</form>

This will format nicely as:

Dave's surprisingly thirsty right now!

See how that works?

Forms are just another block element on a page, so you can really push them around and place them as you would any other block, through an overarching table design for layout, if you'd like, or with CSS positioning (relative or absolute) or even by using attributes like align= (with some experimentation).

Finally, note that there's nothing special about a weblog entry either, so there's no reason you couldn't have a Paypal button in your entry directly (as I have with this article!) by cutting and pasting in the block of content from Paypal's button builder.

Hope that gets you started in the right direction, and if you are interested in learning more about HTML, may I recommend my best-selling book Creating Cool Web Sites with HTML, XHTML and CSS, from J. Wiley & Sons?



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Simpy.

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments

I'm running b2evolution - I'd like to put in a paypal button but have no idea how/where to insert the code.

Thanks MajorHart majorjh@socket.net

Posted by: John Hansen at March 21, 2006 1:10 PM

Note that the above code examples are incomplete and won't work, he's leaving out a bunch of fields. If you want it to work, reveal the source on the page and use the source from one of his actual buttons.

And thanks for putting up this page, it helped me out, but why not put up actual working examples?

Posted by: wrybread at July 15, 2006 4:11 AM

I have a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited commercial email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Uniblue: Free Virus Scan

Search
Find just the answers you seek from among our 1700+ free tech support articles by using our Lijit search engine.


Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]