Solved

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

Posted on 2011-02-15
12
395 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
ID: 34903602
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
ID: 34903616
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
ID: 34903656
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 16

Expert Comment

by:sjklein42
ID: 34903670
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
ID: 34903680
i'm using firefox...let me try IE...
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 34903709
no go in IE,..same results...
0
 
LVL 16

Expert Comment

by:sjklein42
ID: 34903743
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
ID: 34903770
i am running firebug. i'm not sure how to trace the network calls in it though...
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 34903818
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
ID: 34903833
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
ID: 34903876
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
ID: 35133123
thanks for your help
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Initial get page response times and IIS8 15 49
Html5 Index on a table 7 25
Else condition 9 15
Call a function within the ASP code 4 7
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
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…

813 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

14 Experts available now in Live!

Get 1:1 Help Now