SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Backgound form post

    Just wondering if anyone knows how to post values to a script without actually going to the script?

    For example, if you are submitting data from A into B, another script will also get that form submitted data but without actually redirecting the user to that other script.

    Hope that's clear.

  2. #2
    La la la la la bronze trophy lieut_data's Avatar
    Join Date
    Jun 2003
    Location
    Waterloo, ON
    Posts
    1,517
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In B, you could include the second script (which would have access to $_POST), but barring loading multiple frames and a convoluted $_POST parser, I don't think it could be done quite as you described it.
    My name is Steve, and I'm a super-villian.

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could do it with javaScript like in this example:

    Code:
    refstat=new Image(1,1);
    refstat.src="some_other_php_script.php?df=21472&ref="+escape(document.referrer);

  4. #4
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by m.t.
    you could do it with javaScript like in this example:

    Code:
    refstat=new Image(1,1);
    refstat.src="some_other_php_script.php?df=21472&ref="+escape(document.referrer);
    Wouldn't this be a GET and not a POST?

    I'm actually after something like Paypal's IPN, where a post is made to a script all behind the scenes.

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2002
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes this is GET and not POST but why does it matter to you? you can pass information this way - isn't that what
    you wanted?

    I don't know another way myself but I would be very interested if there was another (non JavaScript) solution to this...

    remeber: it only works if the client has JavaScript enabled

  6. #6
    SitePoint Guru dragonhawk's Avatar
    Join Date
    Apr 2002
    Location
    Melbourne
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, one way would be to use the img tag: <img src="script.php?var1=val1&var2=val2" width=1 height=1> - this way, you don't need to use javascript.

    It's just that I don't think the script I want to invisibly submit to accepts GET which is why I needed to POST (if possible).


Bookmarks

Posting Permissions

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