Triggering additional events off a form submit button click.

robray

New Member
Messages
11
Reaction score
0
Points
0
hi there,

Imagine this scenario....

There is a form which collects a customer's name, email address and a shipping address for a purchased item (for example a book).

The submit button on the form links to a paypal payment website.

What i would like to do, is email the shipping address to someone who can send the purchased item once payment is recieved.

So my question is, is there a way of triggering a php function (or script) to do the email task in addition to sending the browser to the paypal payment page.

I would be very grateful for your solutions (and/or suggestions).

Best wishes

Have a nice day :)

Robray.
 

misson

Community Paragon
Community Support
Messages
2,572
Reaction score
72
Points
48
You could use AJAX to submit to the email handler. However, the standard way of handling this situation is to come back to your site after the payment through PayPal has been authorized for a final form processor. This is what sites like eBay, Amazon and NewEgg do. Otherwise, the email will be sent even if the payment isn't authorized. The PayPal documentation should tell you how to do this.
 
Last edited:

Twinkie

Banned
Messages
1,389
Reaction score
12
Points
0
This doesn't answer the question, but this is a more efficient way of handling the scenario. PayPal has a method called IPN (Instant Payment Notification) which will send a message to your site as soon as the payment is completed. It does this by visiting a specialized script on your site, say ipn.php and passes it POST variables that correspond with the purchase. For them, you can get the shipping information, name, and so forth. There is a sample IPN script for handling the POST variables and verifying them available in the PayPal Payments Standard manual.
 

farscapeone

Community Advocate
Community Support
Messages
1,165
Reaction score
27
Points
48
Generally, if you have a form and want to add another event to a "Submit" button add the onsubmit event to the form like this:

HTML:
<form name="some_form" action="script.php" metod="post" onsubmit="submitFunction();">

Where "submitFunction()" is the function you want to execute when form is submitted.
 

xgreenberetx

New Member
Messages
57
Reaction score
1
Points
0
well once you get the $_POST variables and you most likely ave a file that emails the $_POST variables to the customer, just add the persons email next to the customer email addy.

just use a comma when using multiple emails.
 
Top