PDA

View Full Version : PHP question



vicwick
07-19-2011, 11:23 PM
Hi All --

I have a form on a web page that wants to send its data to two different places. I want the dat to go both to an email address AND a url (to a PayPal account). Does anyone have any experience with this? I sure don't.

djr33
07-20-2011, 12:30 AM
In the future please use more descriptive titles.


In some sense, this is not possible. You can't send the same form to two places.

You can develop a script that will be one place and receive the data once but do two things. However, I believe that paypal may require direct submission. But you may be able to get around that.

So basically what you'll do is submit to a PHP page that:
1) sends an email with the information required, and does anything else necessary such as adding the information to a database. Anything on your server can easily be done at this point.
2) Then forwards the transaction to paypal. Look up tutorials on how to integrate paypal using a serverside language (or specifically PHP).

I think this must be possible since that's what a lot of sites do, but you can't submit directly to paypal at the same time as submitting to your email script.


(Technically, there would be no problem if paypal allowed automatically sent emails, but I don't think they do. If they did, you'd just submit it to their server, and paypal would do the rest.)

Does that help you get started? There's a lot of information specifically about paypal out there. It may not be easy, but the question has been asked many times (probably because it is not easy, actually). While we can help with general questions, our expertise regarding paypal-specific questions will be limited to our personal experience.

vicwick
07-20-2011, 12:43 AM
Hi Daniel --

First, thanks for the quick response. I will try your suggestions and see what happens. I've been in over my head so often that I always keep a snorkel next to my desk.

-- Victor

traq
07-20-2011, 03:41 AM
PayPal transactions (Buy Now buttons, etc.) are forms that submit directly to PayPal. In most cases, they're actually hosted on PayPal, meaning you have no control over their contents (including where they submit to). This is a security measure designed to limit fraud on the part of your users; it's actually a very good thing and offers _you_ a lot of protection.

You can write your own PayPal buttons, but PayPal discourages this, and won't offer much help. They don't really want you doing it, and in most cases they're justified in that.

If you do host the buttons yourself, you also take on the responsibility of making them secure. If the markup is freely available on a page somewhere, then someone will eventually find it, tweak it, and start buying things from you for free.

In any case, go directly to PayPal (no Google!) to learn about the process and find example scripts, etc.. Take your time, be thorough, and very careful. Use PayPal's developer tools, forum, and sandbox site. Learn about PDT and IPN (which, depending, you might be able to use to accomplish whatever you're trying to do).

vicwick
07-20-2011, 12:06 PM
Hi Adrian --

The problem I'm having is that a not for profit web site accepts a memorial donation. The user fills out the form and clicks submit, which goes directly to PayPal (using PayPal's buttons). However, I also want the information to go oto the web site owner, so that they are informed of the donation and can send a thank you email. I'd like to do this all in one action, rather then redirecting users to several different pages.

traq
07-20-2011, 02:19 PM
you could probably use IPN for this. Basically, after paypal is done with a transaction, it sends the user back to your website - you can specify where it returns to. set up a page that processes paypal's notification and also sends a notice to the site owner. Since you're not selling things, you wouldn't really need to confirm the transaction, but you could use the IPN notification to get the email address and to personalize the thank-you message ("thanks for donating $20!").

On the paypal site, look up "Instant Payment Notifications."

vicwick
07-20-2011, 04:13 PM
:) I hope I can help someone else someday as well as you have helped me.