Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-02-15
12
Medium Priority
?
412 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:Michael Sterling
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Michael Sterling
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:Michael Sterling
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

Author Comment

by:Michael Sterling
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:Michael Sterling
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:Michael Sterling
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 2000 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:Michael Sterling
ID: 35133123
thanks for your help
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
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 elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

618 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