Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2002
    Location
    Orlando, FL
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with <form> processing in PHP

    The project I'm working on uses a <form> on Website1 to pass user supplied data to a different website: Website2. (Pretty simple so far!)

    The problem is that I want to process some or all of the information on the original Website1 too; such as logging the clickthru and some of the data in a database.

    I can get the <form> to "POST" to a PHP script on Website1 which logs the click-thru but how can I then re-send or re-"POST" the original data to Website2?

    Or would a better approach be to have the process "branch" somehow so that both things happen simultaneously. Maybe by passing the data to a new separate window which opens a PHP script, processes the data, and then closes the window only leaving the original window with Website2 showing. Could this be done with the javascript "onClick=" thing added to the SUBMIT tag like:

    <input type=Submit onClick="http://www.Website1.com">

    Any thoughts? Have I made this clear or confusing?
    GreenMnMs!

    "If the brain were so simple we could understand it, we would be so simple that we couldn't."

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The javascript approach you described would work, though it's rather messy and may confuse the user (having an window opening, closing with no message, and then the form submits). You can save yourself from this hassle with one of three alternative routes:

    1.) Use the Snoopy class that acts like a webbrowser to send your POST request to website2:
    http://sourceforge.net/projects/snoopy/

    2.) Use the cURL extension to send the POST request (may not be installed everywhere, check your host for details):
    http://www.php.net/manual/en/ref.curl.php

    3.) If none of the above should work, you can still try to open a socket and do it the *really* hard way with fsockopen():
    http://www.php.net/manual/en/function.fsockopen.php


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •