php submit form to external site

Discussion in 'PHP' started by redbrad0, Aug 29, 2006.

  1. #1
    I am in need of some code and hopefully someone will be able to help or point me in the correct direction.

    I have a paypal button which a user clicks on and then it submit's the data to paypal and then user is then on paypal's site to pay for the product. What I would like to do is when a user click's on a button it sends them to order-create.php which will do so backend work to setup all the data in the database and then when it is done it will submit the data to paypal along with forward the user to paypal. I have seen code that will submit a form and return the results in html for, but I want it to actually send the user to paypal's site.
     
    redbrad0, Aug 29, 2006 IP
  2. Zedzero

    Zedzero Peon

    Messages:
    322
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if i understood correctly, what you wanted to that is:
    your site ---> your aftersale page (which your script does necessary things) ---> paypal

    why do you want to do that? paypal is designed to work this way:
    your site ---> paypal ---> your aftersale page

    this is better in most ways, especially for your safety. this way, you can be sure that all of the orders (which are not fraud) are real sales.

    what you want is possible but i have never seen something like this...
     
    Zedzero, Aug 30, 2006 IP
  3. redbrad0

    redbrad0 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    No its really isnt for my safety. There is no security, but its actually more secure to have some backend script direct the user to paypal. Then people can not see all of the html of your paypal buttons.
     
    redbrad0, Aug 30, 2006 IP
  4. harsh789

    harsh789 Member

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #4
    See Paypal Instant Payment Notifications(IPN).
     
    harsh789, Aug 30, 2006 IP
  5. jnestor

    jnestor Peon

    Messages:
    133
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You want people to fill out a form on your site and then pay right?

    Perhaps I'm missing the problem. They fill out a form and submit. Your script processes the form (validates the info) and then presents them with a "pay at paypal" button.

    If you want to hide the details of the paypal form, paypal has an option to "encrypt" the form for you.

    If what you're going for is a way to verify that you were payed then zed and harsh are sending you down the right track.
     
    jnestor, Aug 30, 2006 IP
  6. redbrad0

    redbrad0 Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I have paypal IPN setup correctly and it works like a charm. Here is the reason.

    When someone visit's the order page they are buying tickets to a concert thru paypal. So right now when they click the order button on my site I have it take them to another page to verify all the information is correct. As this verification page is loading it inserts a temporary order and tickets into the database. If they change their mind and just leave the page the order/tickets are kept in the temporary que for 15 mins before they are deleted.

    Basically I want it to flow like this

    1. Order Tickets
    2. Confirm Ticket Price and click order
    3. They clicked order and it sends them to another page on my site which inserts the temporary tickets and order.
    4. Then this page submits the data to paypal just as the user clicked on the form

    In ASP this was possible with a 3rd party component. I can not believe that there is no way in PHP to do this same thing.
     
    redbrad0, Aug 30, 2006 IP
  7. harsh789

    harsh789 Member

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #7
    In this case create a form with all data fields hidden on your last page where you inserting data in database. Then on ONLOAD event of the page submit this form to paypal using javascript SUBMIT() call.
     
    harsh789, Aug 31, 2006 IP