
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? 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:
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.
Categorized:
HTML and CSS
(Article 4304)
Tagged: Previous: How can I raise money from Venture Capitalists? Next: How do I delete all but one directory in Linux? Subscribe!
Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader. 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 PMNote 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 AMI have a lot to say, but ...
I do have a comment, now that you mention it!
|
![]()
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!
Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.
Articles and Reviews
Auctions and Online Shopping Blogs and RSS Feeds Building Web site traffic Business and Management Cell Phones and Mobile Phones CGI Scripts and Web Site Programming Computer and Internet Basics d) None of the Above HTML and CSS Mac OS X Help MySpace, Facebook, Twitter and Social Network Help Pay Per Click (PPC) Search Engine Optimization Shell Script Programming Sony PSP, MP3 Players, Etc. The Writing Business Unix and Linux Help Video Game Tips and Help Windows Help
Recent Entries
Join the List!
Book Links
|