+ Reply to Thread
Results 1 to 5 of 5

Thread: Triggering additional events off a form submit button click.

  1. #1
    robray is offline x10Hosting Member robray is an unknown quantity at this point
    Join Date
    Jan 2010
    Posts
    11

    Triggering additional events off a form submit button click.

    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.

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Triggering additional events off a form submit button click.

    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 by misson; 01-30-2010 at 04:23 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  3. #3
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: Triggering additional events off a form submit button click.

    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.

  4. #4
    farscapeone's Avatar
    farscapeone is offline Community Advocate farscapeone is on a distinguished road
    Join Date
    Dec 2008
    Location
    Србија (Serbia)
    Posts
    1,166

    Re: Triggering additional events off a form submit button click.

    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 Code:
    <form name="some_form" action="script.php" metod="post" onsubmit="submitFunction();">
    Where "submitFunction()" is the function you want to execute when form is submitted.

  5. #5
    xgreenberetx is offline x10Hosting Member xgreenberetx is an unknown quantity at this point
    Join Date
    Oct 2009
    Posts
    57

    Re: Triggering additional events off a form submit button click.

    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.

+ Reply to Thread

Similar Threads

  1. email submit button
    By mahlerwd in forum Programming Help
    Replies: 18
    Last Post: 05-21-2008, 08:02 PM
  2. email - submit button
    By mahlerwd in forum Free Hosting
    Replies: 1
    Last Post: 05-14-2008, 11:53 PM
  3. Html Form Search button
    By Otaku Ichise in forum Programming Help
    Replies: 1
    Last Post: 04-21-2008, 09:51 AM
  4. Form Submission Apache Problems
    By EdisonTigersAlumni in forum Free Hosting
    Replies: 12
    Last Post: 11-28-2007, 12:52 PM
  5. A simple Visual Basic Login Form
    By Zenax in forum Tutorials
    Replies: 0
    Last Post: 03-13-2007, 08:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers