Solved

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

Posted on 2011-02-15
12
396 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
displaying 3 dropdownlist  horizontally 3 32
YouTube API get the Video Tags - vb.net 7 32
Telerik RadEditor Control Save 8 15
Regular Expression needed 4 17
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…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
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 …

726 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