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 8340185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:06:39+00:00 2026-06-09T05:06:39+00:00

I’ve made a form. Currently this form does the following operations: customer fills up

  • 0

I’ve made a form. Currently this form does the following operations:

  1. customer fills up the form (creates an order)
  2. clicks on “Submit” button
  3. all form entries are entered into a database.

I’d like to change it to do the following operations:

  1. customer fills up the form
  2. in the end of the form there is a text box showing much this order will cost him.
  3. clicks on “Submit” button (if accepts the price)
  4. redirected to paypal
  5. if the payment is successful -> all form entries are entered into a database. Else -> echo “transaction failed”.

Here is what I’ve done so far:

“form.php” contents

<html><head><title>Title</title></head><body>
<form action="php-form-processor.php" method="post">
    <table border="0" cellspacing="5" width = "500">
        <tr>
            <td align="right" width="160">Choose an Item:</td>
            <td align="left">
            <select name="formItem" value="<?=$varItem;?>" class="input_full" >
                <option value="1">Cheese</option>
            </select>
            </td>
        </tr>
        <tr bgcolor="#D0E8F5">
            <td align="right" >Item count:</td>
            <td align="left">
                <input type="text" name="formItemCount" maxlength="50" value="<?=$varItemCount = 1;?>"  class="input_full" />
            </td>
        </tr>
    </table>
    <p align="center">
    <input type="submit" name="formSubmit" align = "center" value="Submit" />
    </p>
</form></body></html>

“php-form-processor.php” contents

<?php
if($_POST['formSubmit'] == "Submit")
{
    $varItem = $_POST['formItem'];
    $varItemCount = $_POST['formItemCount'];

    //database stuff
    $username = "...";
    $password = "...";
    $hostname = "..."; 
 // connect and add to the database varItem and varItemCount
    mysql_query($sql);
    mysql_close($dbhandle);
}
?>

The form is much bigger but i’ve simplified the stackoverflow’s version of it. The price of an order must change according to “varItem” and “varItemCount” value. Basically I want to add “Pay with PayPal” option before writing an order into the database.
P.S. I’ve already registered paypal Sandbox account and added “Buyer” and a “Seller”.

what should I do next?

EDIT: ok, so here is a small guide how to solve the problem. Here are some advises:

  • first, download paypal IPN listener wrapper: https://github.com/Quixotix/PHP-PayPal-IPN
  • then register SandBox account plus 1 buyer and 1 seller acc
  • login as a seller and create a form (with non-hosted button!)
  • place the form into your page and parse the ID or any other necessary information via “custom” input (some helpful advises can be found here: http://www.devshed.com/c/a/PHP/Creating-a-Paypal-IPN-System-in-PHP-Part-Two/)
  • now place redirect to this page after Form submit
  • don’t forget to enable IPN at paypal Seller account and enter IPNlistener link into a necessary address field
  • submit a paypal form and wait for response on listener
  • done

Whole proccess looks like this:

  1. customer fills up the form
  2. after submitting the form – all entries are written into the database + ID + 1 additional field called “payed” which represents: 1 – if customer payed for an order and 0 – if not
  3. use header(“Location: URL”) to redirect from Form_Processing to Paypal_Form
  4. use the “session” to write order ID into a session or use POST message
  5. submit the PaypalForm and use “custom” field as a carier for our order ID
  6. set up the listener to update the database as following: if transaction was successful -> update the database column “payed” to 1 (done). Use the ID from “custom” field to select needed order i.e.:

$sql = “UPDATE paypal_test SET payed = ‘1’ WHERE id = ‘”.$_POST[‘custom’].”‘”;

Now we have a database with completed and non-completed forms. Additionaly you can write a logic which will remove “old” uncompleted orders. For this reason you can create additional column called “date” and then compare: if (current_date.days – old_date.days > 7) -> remove from DB. That’s it!

  • 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-06-09T05:06:41+00:00Added an answer on June 9, 2026 at 5:06 am

    I would not accept what the PayPal post back is giving you, it’s a sloppy way of checking the authentication of the user and expects the user to click the “go back to website” button. Instead use the IPN (https://www.paypal.com/ipn/) and make sure you post the response back to PayPal for verification.

    Checkout this PHP example from PayPal: https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNImplementation

    • 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'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
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.