Industry guru Dave Taylor offers tech support on technical and business topics, including iPhone, iPod, Microsoft Windows, Sony PSP, cellphones, online advertising, CSS, Web design, business, Unix, Linux, SEO, Mac OS X, and shell script programming.     


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?


More Useful HTML, JavaScript and Web Site Programming Articles:
✔   How to Create Predefined Google Image Search Links?
Thanks for the Amazon URL [see Creating Amazon Search Links]. That worked beautifully. In fact, I sent you $5.00 for coffee in thanks....
✔   Can I embed a Facebook search box on my blog site?
I've seen your articles about how to add a Twitter or Google search box on a Web page, but I have a tougher...
✔   Can I use CSS for drop shadows on my blog?
I want to give my site a bit of a facelift and add some neat graphical elements. One of which is drop shadows....
✔   How can I embed interactive photo panoramas on my site/blog?
I read through your blog entry about how to take panoramic photos with iOS 6 and an iPhone 5 and got enthused. I've...
✔   How can I create a Twitter search URL shortcut?
I'd like to add a few Twitter search links to my Web site. Is that possible, or does Twitter prohibit this sort of...

Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
    Enter your name: and your email addr:  




Categorized: HTML, JavaScript and Web Site Programming   (Article 4304, Written by )
Tagged: online transactions, paypal, paypal customization, shopping carts
Previous: How can I raise money from Venture Capitalists?
Next: How do I delete all but one directory in Linux?




Reader Comments To Date: 2

John Hansen said, on March 21, 2006 1:10 PM:

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

wrybread said, on July 15, 2006 4:11 AM:

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?

Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!

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











I will never send you any unsolicited email. Ever.






Check This Out Too...

 
Look for Answers
Need Help? Ask Dave Taylor!


Follow Me on Pinterest

Find Me on Google+
ADT on G+
© 2002 - 2013 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. Further, 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. My lawyer says "Thanks".
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.