Forum Moderators: open
Page 1 (index.php) has a search engine.
Page 2 (results.php) has an iframe called results.
How do I get Page 2 to display the results when searching on page 1?
Dont tell me this is impossible because I know it is possible.
<form action="http://www.example.com/searchresults.html" method="get" name="frm" target="_top" id="frm">
<fieldset>
[edited by: tedster at 5:37 am (utc) on Sep. 26, 2009]
[edit reason] switch to example.com - it cannot be owned [/edit]
Searching for "cheese". Page 1 sens a POST value to Page 2.
Page 2 acquires POST value. If Page 2 has an iframe in it then it must be framing a page, Page 3. Page 3 = iframedresults.php. Attach POST variable to URL.
iframedresults.php?search=cheese
Page 3 can use GET to do something with cheese.
if (isset($_GET['get_results'])) {
// output your results, which will go in the iframe
// echo results page
}
else {
$frame_page = '<html><head><title>Results</title></head><body>
<h1>Results</h1>
<p>page content here</p>
<iframe src="results.php?get_results=1&search_params=Encoded+Search+Params"></iframe>
</body>
</html>
';
echo $frame_page;
}
Simplified for example, basically, when posting to results.php, if "get_results" doesn't exist, output the frame page and pass the search parameters back to results.php with "get_results" added as a parameter, and it will output the content within the frame.