SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    interstitial page- saving post/get variables and sending them to next page

    Hi,

    I have page- form.php . It sends say- var1, var2 ... var n variables to interstitial.php . interstitial.php will show an advertisement and there will be a button to skip the ad. I want to send all variables then to post.php.

    How do I do that? I thought of hidden variables but for every request the variables might change.

    Can you guys help!

    Thanks,
    Nishant

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    You might create the querystring to send to post.php (they will be visible), or you can put them in a session (they won't be visible).
    I don't think hidden variables (= a form) is the way to go, unless one always has to press the button to continue.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Creating a query string means- sending variables by GET method? Am I right! So if I send the variables by get method then I have to somehow send all the variables to the final page.

    Suppose inter.php?var1=name&var2=place&var3=animal
    then clicking on SKIP button must open final.php?var1=name&var2=place&var3=animal

    How to do this?

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    If the variables always arrive to inter.php in the querystring, then you might use

    $_SERVER['QUERY_STRING'] and paste it to final.php.

    If they can also arrive by POST, then you'll have to loop through $_POST and create the querystring yourself.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! But is there a limit to the amount of data you can send through a querystring?

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,509
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    I don't know. I'm sure there is
    If you have too much data to send, then you might want to think about using sessions.

  7. #7
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I am using this to make a facebook app. So I dont want to get into sessions thing. I am thinking of using this function to build hidden fields.

    <?php
    while (list($key,$value) = each($_POST)){
    echo "Key: ".$key . "Value: ".$value."<br />";
    }
    ?>

  8. #8
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I am using this to make a facebook app. So I dont want to get into sessions thing. I am thinking of using this function to build hidden fields.

    <?php
    while (list($key,$value) = each($_POST)){
    echo "Key: ".$key . "Value: ".$value."<br />";
    }
    ?>

  9. #9
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK heres the working code. Hope it helps someone! Thanks quido for your help!

    <form action="result.php" method="post">
    <?php

    while (list($key,$value) = each($_POST)){
    echo "<input type=hidden name=\"$key\" value=\"$value\">";

    }
    ?>
    <input class=inputbutton type=submit value="Skip This Advertisement">
    </form>

  10. #10
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    I don't know. I'm sure there is
    If you have too much data to send, then you might want to think about using sessions.
    Completely OT, but for future reference:

    The spec for URL length does not dictate a minimum or maximum URL length, but implementation varies by browser. On Windows: Opera supports ~4050 characters, IE 4.0+ supports exactly 2083 characters, Netscape 3 -> 4.78 support up to 8192 characters before causing errors on shut-down, and Netscape 6 supports ~2000 before causing errors on start-up.
    From: http://classicasp.aspfaq.com/forms/w...arameters.html


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
  •