Forum Moderators: open

Message Too Old, No Replies

ASP and forms submission

A how do I do it....

         

slow2start

11:46 pm on Aug 26, 2005 (gmt 0)



Please forgive me is this is simply a dumb simple question, but I am not much of an expert using ASP or writing forms.

I have hacked an existing ASP page which calls itself several times to display and do different things, depending on what step in the process you are in.

Here is what I am doing.
The first step gives you a form where you fill out all the typical information for registering for an event.

The second step, displays this information in a nice formated screen asking you if everything is correct for your registration.

The third step does not display anything, it formate the good collected data into two emails, one to the person sending in the registration, and one to our administrator.

The fourth step currently displays a thank you.

On the second step the user is given two choices, "register/and pay" or "return to correct information".

Here is my problem. The button that calls the ASP page for it's third step, passing all the data as a form. On the third step, I use the form data passed to format the emails. It does not display anything back to the user until after the emails have been sent, and then it calls itself again , this time indicating step 4 and it displays the thank you screen.

I want to change step 3 to send the necessary information to paypal like using a "buy now" button, but I don't want any buttons at all. I just want to fill in all the hidden input fields with the correct information and submit this "hidden form" to paypal as if someone had pressed a "buy now" button.

I will remove step 4, the Thank You screen, and make it the screen Paypal sends the person back to after they do the credit card thing.

So in short, how do you send a form with no buttons?

Here is the current code that works but with a button. I just want it to happen when the "if" statement surrounding step 3 (sends the email) is true.

' <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
' <input type="hidden" name="cmd" value="_xclick">
' <input type="hidden" name="business" value="me@someplace.org">
' <input type="hidden" name="item_name" value="Cruise November 12">
' <input type="hidden" name="item_number" value="CR111205">
' <input type="hidden" name="amount" value="100.00">
' <input type="hidden" name="undefined_quantity" value="1">
' <input type="hidden" name="no_note" value="1">
' <input type="hidden" name="no_shipping" value="1">
' <input type="hidden" name="return" value="http://here.org/cruises/cruise-thankyou.asp">
' <input type="hidden" name="cancel_return" value="http://www.here.org/">
' <input type="hidden" name="currency_code" value="USD">
' <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">&nbsp;
' <font face="Arial" size="2">Cruise November 12</font>
' </form>

mrMister

2:36 pm on Aug 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The simplest way would be to output some client side javascript but bear in mind that it won't work in non javascript browsers, so you'll want to put a button in noscript tags as well...

<script language="javascript">document.forms[0].submit()</script>
<noscript><input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit"></noscript>

Mall23

7:14 am on Sep 2, 2005 (gmt 0)

10+ Year Member



Or use XML in your ASP and just POST all that form gunk to the paypal server.

Get the result and spit it out to the browser.

May/may not work...because of PayPal's SSL...but you might play with it. I'd be interested if it worked :)