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
    Regular Coder
    Join Date
    Oct 2003
    Posts
    603
    Thanks
    2
    Thanked 1 Time in 1 Post

    php and framsets

    is there any way to capture a GET variable from a frameset to aid in redirection?

    i have two frames. one header one with a header pic to link to the home page and the bottom one redirects to Yahoo Search.

    -websearch.html
    -------------------------
    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>Web Search</title>
    </head>

    <frameset rows="118,*">
    <frame name="header" scrolling="no" noresize target="main" src="webs_top.htm">
    <frame name="main" src="web.php">
    <noframes>
    <body>

    <p>This page uses frames, but your browser doesn't support them.</p>

    </body>
    </noframes>
    </frameset>

    </html>
    ----------------------

    webs_top.htm
    ---------------------
    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 2</title>
    <base target="main">
    </head>

    <body topmargin="0" leftmargin="0" bgcolor="#800000">

    <p><a target="_top" href="http://nmcw.net/home.php">
    <img border="0" src="top223.gif" width="794" height="115"></a></p>

    </body>

    </html>
    ------------------

    web.php
    ------------------
    <?php
    $q = $_GET['g'];
    header("location: http://search.yahoo.com/search?p=$q");
    ?>

    -this web.php code wont capture the GET variable sent to websearch.html and that's what im wondering if i can do

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can't be done. Because PHP runs on the server, it hasn't go the slightest idea what frames are and how they're supposed to work. You just discovered one of the more subtle reasons why most (all?) CMS do serve their content without frames.

    What you could do though is to write the GET parameter that appears on websearch.html to the URL to the framed page (like echo "web.php?param=$_GET[foo]";), then it will be available to web.php too. That would require that the frameset page is parsed by PHP.
    De gustibus non est disputandum.


  •  

    Posting Permissions

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