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

Posted on 2009-04-22
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
    LVL 36

    Expert Comment

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

    Expert Comment

    by:Loganathan Natarajan
    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
    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...

    Author Comment

    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
    LVL 36

    Accepted Solution


    Author Closing Comment

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

    Expert Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    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…

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now