XHTML 1.0 Strict Validatable Paypal Button
As I said in my last post, I needed to find a way to make the code for a paypal button validate in XHTML 1.0 Strict and I have now found the solution.
Here is a copy of the code (leaving out the personal info).
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><input type="hidden" name="encrypted" value="----- BEGIN -----
"></form>
There are a few problems with this code but everything is extremely easy to fix.
1. wrap everything inside the form tags with paragraph tags
2. close all of the input tags
3. take out both border=”0″ - it won’t alter the look of the button at all
And here is what the finished code looks like
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"><p>
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /><input type="hidden" name="encrypted" value="----- BEGIN -----" /></p></form>
So, I hope this helps some of you validation junkies out there. I know quite a few people need paypal buttons on their site and there’s no reason for it to be the only aspect of the page that doesn’t validate.


Subscribe
Digg
Save
Stumble
Bump
Float
Vote











Leave your response!