passing variables via forms

Discussion in 'HTML' started by don, May 16, 2005.

  1. don

    don Guest

    I have a form which when the user clicks the submit button it calls another
    page which generates some stuff - however, on this second page I have an
    iframe which generates a table which needs the variables from the first page
    passed to it - is there a way to do this?
    don, May 16, 2005
    #1
    1. Advertising

  2. don

    Toby Inkster Guest

    don wrote:

    > I have a form which when the user clicks the submit button it calls another
    > page which generates some stuff - however, on this second page I have an
    > iframe which generates a table which needs the variables from the first page
    > passed to it - is there a way to do this?


    Yes. Let's call the first page "pagea.html", the second page "pageb.php"
    and the iframe thats inserted into the second page "iframe.php". And the
    data that we're passing around is called "query".

    Examples use PHP, but the same basic idea will work in other server-side
    languages too.

    ================ pagea.html ================
    <form action="pageb.php" method=get>
    <div>
    <input name=query>
    <input type=submit>
    </div>
    </form>
    ============================================

    ================ pageb.php =================
    <?php
    $query = ($_GET['query']?$_GET['query']:'BLANK');
    $qurl = htmlentities(urlencode($query));
    ?>

    <p>Query was <tt><b><?=$query?></b></tt>.</p>

    <iframe name=foo height=100 width=200 src="iframe.php?query=<?=$qurl?>">
    Your browser does not support <code>iframe</code>.<br>
    Please go to the <a href="iframe.php?query=<?= $url ?>">page</a>
    manually.
    </iframe>
    ============================================

    ================ iframe.php ================
    <?php
    $query = ($_GET['query']?$_GET['query']:'BLANK');
    ?>
    <p>Query was <tt><b><?=$query?></b></tt>.</p>
    ============================================

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, May 16, 2005
    #2
    1. Advertising

  3. "don" <> wrote in message
    news:d6931e$87k$...
    >I have a form which when the user clicks the submit button it calls another
    > page which generates some stuff - however, on this second page I have an
    > iframe which generates a table which needs the variables from the first
    > page
    > passed to it - is there a way to do this?
    >
    >


    One method that ought to work is using frames and javascript.
    If this is acceptable to you, you can have the scripting code with
    variables in the top (frameset) frame, load the different pages in
    a single frame and access the top frame variables from there.

    Good luck
    Anders

    ---
    m a i l: anders d o t flodrus a t comhem d o t se
    ANDERS FLODERUS, May 16, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aitham alama

    Passing Variables between web forms

    Aitham alama, Jul 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    366
    DalePres
    Jul 10, 2004
  2. Gerry Hickman
    Replies:
    2
    Views:
    1,490
    Gerry Hickman
    Dec 14, 2005
  3. Replies:
    3
    Views:
    743
    Chris Dollin
    Aug 31, 2005
  4. Replies:
    9
    Views:
    926
  5. Eric
    Replies:
    2
    Views:
    464
Loading...

Share This Page