Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Paypal Shopping Cart invalid XHTML

Featured Replies

I'm redesigning a site which makes use of the Paypal shopping cart script. The problem is that the code paypal give you is not valid XHTML, so I have changed it so that it validates, but it no longer works properly. I think it's because I removed the attribute target="paypal" but I'm not sure. It still adds the item to the cart, but it no longer opens a new window to do so, and the shopping cart no longer has the continue shopping button...

 

Does anyone know of a way of making this work and validate?

 

Old code and new (valid) code shown below.

 

Thank you

 

Code as provided by paypal

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="image" src="https://www.paypal.com//en_GB/i/btn/sc-but-01.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="name@domain.com">
<input type="hidden" name="item_name" value="Catalogue Item">
<input type="hidden" name="amount" value="20.00">
<input type="hidden" name="buyer_credit_promo_code" value="">
<input type="hidden" name="buyer_credit_product_category" value="">
<input type="hidden" name="buyer_credit_shipping_method" value="">
<input type="hidden" name="buyer_credit_user_address_change" value="">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="bn" value="PP-ShopCartBF">
</form>

 

And my valid version

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p><input type="image" src="https://www.paypal.com//en_GB/i/btn/sc-but-01.gif"  name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="add to cart" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="business" value="name@domain.com" />
<input type="hidden" name="item_name" value="Catalogue Item" />
<input type="hidden" name="amount" value="20.00" />
<input type="hidden" name="buyer_credit_promo_code" value="" />
<input type="hidden" name="buyer_credit_product_category" value="" />
<input type="hidden" name="buyer_credit_shipping_method" value="" />
<input type="hidden" name="buyer_credit_user_address_change" value="" />
<input type="hidden" name="no_shipping" value="2" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-ShopCartBF" /></p>
</form>

  • 1 month later...

why dont you test it with the paypal sandbox?

 

there is no way to know before you test it

Hey notbanksy,

 

just you make the target="_blank" from target="paypal" and your code will work as it was and will also validate.

Here is the code

 

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<p><input type="image" src="https://www.paypal.com//en_GB/i/btn/sc-but-01.gif"  name="submit" alt="Make payments with PayPal - it's fast, free and secure!" />
<img alt="add to cart" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="business" value="name@domain.com" />
<input type="hidden" name="item_name" value="Catalogue Item" />
<input type="hidden" name="amount" value="20.00" />
<input type="hidden" name="buyer_credit_promo_code" value="" />
<input type="hidden" name="buyer_credit_product_category" value="" />
<input type="hidden" name="buyer_credit_shipping_method" value="" />
<input type="hidden" name="buyer_credit_user_address_change" value="" />
<input type="hidden" name="no_shipping" value="2" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="GB" />
<input type="hidden" name="bn" value="PP-ShopCartBF" /></p>
</form>

Subhajit, that will only validate on a transitional doctype.

 

Notbanksy is probably coding to a strict doctype, so it wouldn't validate.

Subhajit, that will only validate on a transitional doctype.

 

Notbanksy is probably coding to a strict doctype, so it wouldn't validate.

 

You are right, and I think he too knows target will not validate for Strict Doctype... :)

And in transitional Doctype if the value of target is different from these (_blank, _parent, _self, _top), then the code will not validate..

 

But above he has not mentioned anywhere the his Doctype is set to Strict :unsure:

But above he has not mentioned anywhere the his Doctype is set to Strict :unsure:

 

True, but if you have a look at the site mentioned in his signature, it's coded to the strict doctype. Which is why I assume he's using strict accross the board.

True, but if you have a look at the site mentioned in his signature, it's coded to the strict doctype. Which is why I assume he's using strict accross the board.

 

Oops didn't noticed his Signature... :p

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.