Forum Moderators: coopster
Here's the situation: My site has a form that allows people to sign up for membership. I'm writing PHP to put that info into a database when they click "submit." They then continue down the page and click another "submit" button that takes them to a secure PayPal site to pay for the membership. It's done this way because lots of our members buy memberships for someone else, so the database records often don't have any relationship to the PayPal data (other than to confirm that each membership has been paid for).
What I'd love to be able to do, of course, is have one "submit" button that does both actions -- run the PHP that puts the form data into the database plus call the PayPal site. (Actually, it would be awesome if the same submit button also triggered an automatic e-mail to let me know that a membership has been added, but perhaps that's asking too much...)
Is this possible? If so, is it reasonably do-able for someone with pretty limited programming skills or is it a super-fancy trick that requires real finesse and/or client-side progams? If it requires anything other than XHTML and PHP, I'll just stick with my current 2-step, 2-button method.
Craig
Sunnyvale, CA
On whatever script you are running after hitting the submit button whether it is on the same page or different, you can create blocks of codes to do any number of tasks you require.
//[BLOCK 1]
//Form data to database code
mysql_query("INSERT INTO ...
//[BLOCK 2]
// Automatic Email Notification
mail($to, $subject, $message, $headers);
. . .
//[BLOCK 3]
// Redirect to Paypal website
header("Location: [paypal...] . . .