Y
Yourself
Hi, I'm trying to post data to PayPal for a shopping cart, basically I want
to replicate a form like the following, but create the variables dynamically
from code behind:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business"
value="(e-mail address removed)">
<input type="hidden" name="item_name"
value="Aggregated items">
<input type="hidden" name="amount" value="3.00">
<input type="submit" value="PayPal">
</form>
How can I create the hidden input variables in a code behind file and have
the data posted to https://www.paypal.com/cgi-bin/webscr and the user
redirected to that site?
I'm using the .NET 2 framework, but I still can't figure this out.
The only way I've been able to get somewhere is to have a PayPalForm.aspx
file which is displayed in an iframe (inside a checkout user control), and
has the following code:
<form name="paypalform" id="paypalform"
action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<asp
laceHolder ID="pchMain" runat="server"></asp
laceHolder>
</form>
Then, in the PayPalForm.aspx.cs file, I can add the hidden input variables
to the placeholder.
The problem with this approach though, is I need to access other controls (a
radio button list) that are on the checkout.ascx file which the iframe sits
on.
So I have:
Checkout.ascx
Radio Button List
Iframe
PayPalForm.aspx
and I need to access the radio button list from within PayPalForm.aspx.cs
Does that make sense??!!
to replicate a form like the following, but create the variables dynamically
from code behind:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business"
value="(e-mail address removed)">
<input type="hidden" name="item_name"
value="Aggregated items">
<input type="hidden" name="amount" value="3.00">
<input type="submit" value="PayPal">
</form>
How can I create the hidden input variables in a code behind file and have
the data posted to https://www.paypal.com/cgi-bin/webscr and the user
redirected to that site?
I'm using the .NET 2 framework, but I still can't figure this out.
The only way I've been able to get somewhere is to have a PayPalForm.aspx
file which is displayed in an iframe (inside a checkout user control), and
has the following code:
<form name="paypalform" id="paypalform"
action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<asp
![Stick Out Tongue :P :P](/styles/default/custom/smilies/tongue.gif)
![Stick Out Tongue :P :P](/styles/default/custom/smilies/tongue.gif)
</form>
Then, in the PayPalForm.aspx.cs file, I can add the hidden input variables
to the placeholder.
The problem with this approach though, is I need to access other controls (a
radio button list) that are on the checkout.ascx file which the iframe sits
on.
So I have:
Checkout.ascx
Radio Button List
Iframe
PayPalForm.aspx
and I need to access the radio button list from within PayPalForm.aspx.cs
Does that make sense??!!