charlieyin
charlieyin

Reputation: 411

Converting <input type="image"> to <input type="button"> but keeping the same functionality

I am trying to convert a Paypal "add to cart" button from an image to a regular button.

This is this code:

              <form
                target="paypal"
                action="https://www.paypal.com/cgi-bin/webscr"
                method="post"
              >
                <input type="hidden" name="cmd" value="_s-xclick" />
                <input
                  type="hidden"
                  name="hosted_button_id"
                  value="XXXXXXX"
                /><br />
                <input
                  type="image"
                  src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_SM.gif"
                  border="0"
                  name="submit"
                  alt="PayPal - The safer, easier way to pay online!"
                />
                <img
                  alt=""
                  border="0"
                  src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"
                  width="1"
                  height="1"
                />
              </form>

This is adding a paypal button using the linked .gif image, however when I change <input type="image" to <input type="button" and get rid of the src, the functionality breaks and it no longer adds the item to the cart -- clicking on the button does nothing. Any help would be appreciated!

Upvotes: 1

Views: 45

Answers (1)

Nana
Nana

Reputation: 51

Change to a button that submits the form:

<input type="submit" ...>

Upvotes: 2

Related Questions