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

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?  
Who is Participating?
Loganathan NatarajanConnect With a Mentor LAMP DeveloperCommented:
Loganathan NatarajanLAMP DeveloperCommented:
You can have auto submit facility on one page where it inserts and submit to paypal page..
Loganathan NatarajanLAMP DeveloperCommented:
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

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Loganathan NatarajanLAMP DeveloperCommented:
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...
ultramooAuthor Commented:
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?
Loganathan NatarajanLAMP DeveloperCommented:
ultramooAuthor Commented:
Great thanks! This was the solution I was looking for.
Loganathan NatarajanLAMP DeveloperCommented:
glad to help, thanks for your points
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.