Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4265712
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:39:41+00:00 2026-05-21T06:39:41+00:00

I’ve been struggling with this for hours and can’t wrap my head around where/how

  • 0

I’ve been struggling with this for hours and can’t wrap my head around where/how to call a php function to insert order details into MySQL upon user clicking the Buy button (doing so at this point allows me to track orders that go to Paypal and then are abandoned).

I thought to put it in the <form action=> tag, (for example, <form action='addToMySQL.php' method='post'>) but that’s where the Paypal url goes, yes? Function must be run server side, so can’t use js… So… how to do this?

cURL has been suggested, and I’ve seen it recommended before, but would the user still be redirected to Paypal’s payment page and then returned back to my site? Can anyone suggest a relevant web tutorial?

I’m new to web programming so details would be appreciated.

Function that creates the form to be sent to PayPal is:

function create_paypal_checkout {
return "
<form action='".PAYPAL_URL."' method='post'>
    <input type='hidden' name = 'business' value='".PAYPAL_ID."' />
    <input type='hidden' name = 'cmd' value='_cart' />
    <input type='hidden' name = 'upload' value='1' />
    <input type='hidden' name = 'currency_code' value='USD' />
    <input type='hidden' name = 'lc' value='US' />
    <input type='hidden' name='rm' value='2' />
    <input type='hidden' name='cancel_return' value='http://www.mydomain.com/'>
    <input type='hidden' name='notify_url' value='http://www.mydomain.com/ipn-listener.php'>
    <input type='hidden' name='return' value='http://www.mydomain.com/thankyou.php?custIP=".$custip."' />

    " . render_shopping_cart($shopping_cart) . "

<table class='formBuyButton'>
<tr id='sc_total'>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td id='ppbutt'>
        <input type='image' name='submit' src='https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_US/i/btn/btn_buynowCC_LG.gif' border='0' alt='PayPal - Buy Now' />
    </td>
</form></tr></table>" ;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:39:42+00:00Added an answer on May 21, 2026 at 6:39 am

    I had the same problem and I solved it using ajax. What I do is to call a php script using ajax before submitting the form to Paypal. Here, I’m using the post function from jquery, since it easier. You need to have jquery somewhere and to point to it. When the user submit the form, mycall() is first called, and if it returns true, then the form it submitted to PayPal.

    <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
    <script type="text/javascript">
        function mycall() {
            $.post('addToMySQL.php', {...}); // Replace ... with arguments
            return true;
        }
    </script>
    
    <form action='".PAYPAL_URL."' method='post' onSubmit='return mycall();'>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.