...

View Full Version : php and framsets



boeing747fp
11-17-2003, 12:46 AM
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

mordred
11-17-2003, 12:53 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum