Solved

Why does this paypal form / button / link send me back to my page?

Posted on 2011-02-15
12
392 Views
Last Modified: 2012-06-21
I'm trying to ad a simple "View Cart" paypal form / button to a very simple web page. when testing, if i click on the link, the page that i'm on simply refreshes and doen't go anywhere. what am i doin wrong? (see code below)

i removed the code between the: -----BEGIN PKCS7----- and  -----END PKCS7-----

pieces in the of the value property of the 2nd input control. didn't know if it was sensitive or not...

<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="encrypted" value="-----BEGIN PKCS7-----
-----END PKCS7-----"/>
    <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_viewcart_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"/>
    </form>

Open in new window

0
Comment
Question by:mikesExpertExchange
  • 7
  • 5
12 Comments
 
LVL 16

Expert Comment

by:sjklein42
Comment Utility
Try getting rid of the target="paypal".
<form action="https://www.paypal.com/cgi-bin/webscr"  method="post">

Open in new window

0
 
LVL 1

Author Comment

by:mikesExpertExchange
Comment Utility
man i wish that would've worked. it's still sending me right back to the same page.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
Comment Utility
i could just put a hyperlink or <a></a> tag around the image i guess...but will that cause any other problems? I've never worked with paypal like this so i'm not sure. my biggest question is when this link does work, is it supposed to open to a specific paypal item, using the information that i removed to pre populate some fields? I realize this may be a question for paypal so i'll direct the latter portion to them, but i don't understand why this button won't open up to a place in pay pal instead of just refreshing the window.
0
 
LVL 16

Expert Comment

by:sjklein42
Comment Utility
When I get rid of the target="paypal", it seems to work for me.  I click on the button and after a few seconds my page is refreshed with a Paypal page.

Try it here:

http://www.sjklein.com/foo.html

Does it work for you?

I'm using IE8 if that matters.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
Comment Utility
i'm using firefox...let me try IE...
0
 
LVL 1

Author Comment

by:mikesExpertExchange
Comment Utility
no go in IE,..same results...
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 16

Expert Comment

by:sjklein42
Comment Utility
Strange.  Works for me :)

Have you tried firebug addin for firefox to try tracing the network calls?  That might help with debugging.  If you aren't already using firebug you will love it.

But seriously, the page does work for me.  With the link I posted, when I click on the button I  end up on a Paypal page.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
Comment Utility
i am running firebug. i'm not sure how to trace the network calls in it though...
0
 
LVL 1

Author Comment

by:mikesExpertExchange
Comment Utility
figured it out, just by chance though. but maybe you can help me out. i placed it on a page that had it within content place holders from a master page initially. so it seemed to just be reposting to the page itself. when i placed in on a simple page with just the button then in went to the paypal site. see code below. how do i make it work within a child page of a master page?
-------THIS WORKS FINE------------

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick"/>
    <input type="hidden" name="encrypted" 
value="-----BEGIN PKCS7-----   -----END PKCS7-----"/>
    <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_viewcart_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"/>
    </form>
</body>
</html>


---------THIS,...NOT SO MUCH (NOT AT ALL)--------

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        Welcome to ASP.NET!
    </h2>
    
    <p>
        To learn more about ASP.NET visit <a href="http://www.asp.net" title="ASP.NET Website">
            www.asp.net</a>.
    </p>
    <p>
        You can also find <a href="http://go.microsoft.com/fwlink/?LinkID=152368&amp;clcid=0x409"
            title="MSDN ASP.NET Docs">documentation on ASP.NET at MSDN</a>.
    </p>
    <div>
        <img src="image/ecwcPostCard1.jpg" alt="The Post Card" style="width: 900px" />
        <%--<asp:HyperLink ID="hlTest" runat="server" Text="Paypal" Target="_blank" NavigateUrl="https://www.paypal.com/cgi-bin/webscr" />--%>
    </div>
    <%--<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="https://www.paypal.com/cgi-bin/webscr">--%>
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick"/>
    <input type="hidden" name="encrypted" 
value="-----BEGIN PKCS7----- -----END PKCS7-----"/>
    <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_viewcart_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"/>
    </form>
    <%--</asp:HyperLink>--%>
    
</asp:Content>

Open in new window

0
 
LVL 16

Expert Comment

by:sjklein42
Comment Utility
Start Firefox

Tools/Firebug->Open Firebug
I adjust the size of the lower pane to be about half the height of the whole window.

Then click on the Firebug Net tab.  Be sure it is Enabled
On the row below "Net", be sure "All" is selected.

Then do your thing in the main browser window (http://www.sjklein.com/foo.html, for example)

As long as the Net panel is active you should see a trace of all page requests.
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 500 total points
Comment Utility
Both ViewCart buttons in your example work fine on my system.  I can't reproduce the problem using the code you posted.

Is it easy for you put your (ostensibly broken) version on the web and post a link so I can try it directly?
0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
Comment Utility
thanks for your help
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now