How to submit a PayPal form into database AND PayPal site at one time

Posted on 2009-04-22
Medium Priority
Last Modified: 2013-12-12
How can I program my PayPal form to submit to the paypal site and at same time insert the submitted form entries (i.e. name, address, product, price, quantity etc.) to my database? I'm programming in php but I need to know the best way to make the form execute two actions. Can this be done in php with a function or in JavaScript? (I already know about inserting entries into database and everything but just need to know how to make a form submit to two places or carry out two different actions with one submit click.) Any suggestions?  
Question by:ultramoo
  • 6
  • 2
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 24203457
You can have auto submit facility on one page where it inserts and submit to paypal page..
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 24203483
something like this

	// Your database inserts actions
	<form name="frmpremium" method="post" action="<?php echo $action_url; ?>">
		<input type=hidden name="Amount" value="<?php echo $amount; ?>">
		<input type=hidden name="Order_Id" value="<?php echo $Order_Id; ?>">	
		<input type=hidden name="Merchant_Id" value="<?php echo $Merchant_Id; ?>">		
		<input type=hidden name="WorkingKey" value="<?php echo $WorkingKey; ?>">	
		<input type=hidden name="Redirect_Url" value="<?php echo $basic_redirect_url; ?>">
		<input type=hidden name="Checksum" value="<?php echo $Checksum; ?>">
		<input type="hidden" name="billing_cust_name" value="<?=$arr_profile[0]['prof_name']?>"> 
		<input type="hidden" name="billing_cust_address" value="<?=$arr_profile[0]['prof_con_address']?>"> 
		<input type="hidden" name="billing_cust_country" value="<?=$arr_profile[0]['con_name']?>"> 
		<input type="hidden" name="billing_cust_tel" value="<?=$arr_profile[0]['prof_contactphone']?>"> 
		<input type="hidden" name="billing_cust_email" value="<?=$arr_profile[0]['prof_email']?>"> 
		<input type="hidden" name="billing_cust_notes" value="">
		<input type="hidden" name="delivery_cust_name" value="<?=$arr_profile[0]['prof_name']?>"> 
		<input type="hidden" name="delivery_cust_address" value="<?=$arr_profile[0]['prof_con_address']?>"> 
		<input type="hidden" name="delivery_cust_tel" value="<?=$arr_profile[0]['prof_contactphone']?>"> 		
		<input type="hidden" name="Merchant_Param" value="<?php echo $Merchant_Param; ?>">
	<script language="javascript" type="text/javascript">

Open in new window

LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 24203488
by the way, one more option from Paypal..

after paypal actions done, you can redirect to success page and retrieve the details from Paypal IPN service and store it in the db...
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 24203579
Thanks! Actually I think the second option is a better way to go since the transaction will be confirmed for sure. How does the IPN service work? Is there some sort of code I can easily add to my site and then modify from there?
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 24203601
LVL 36

Accepted Solution

Loganathan Natarajan earned 2000 total points
ID: 24203605

Author Closing Comment

ID: 31573219
Great thanks! This was the solution I was looking for.
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 24203958
glad to help, thanks for your points

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question