Hi all
I have a form in a frame of a frame set, and on submit, I want a different page to load in another frame. I thought I should use the ususal header function, and add the frame target, like:
header ('location: myPage.php', 'rightframe');
But this is not working (althought "myPage.php" does load, but in the same frame as the form).
Somebody knows the solution?
Thanks...
header (location, frame)? (load page in a frame on submit)
Moderator: General Moderators
-
sebnewyork
- Forum Commoner
- Posts: 43
- Joined: Wed Mar 17, 2004 10:20 pm
Hey,
This works with iFrames and I'm assuming they work the same.
Have your form in frame 1 submit to itself and before you being output, check for any _POST or _GET data to indicate this is a form submission and not a fresh load.
If you have any form data, just pass it on to the script in the other frame via an onload attribute in the body tag. Here's an example:
Hope that helps.
~Scott
This works with iFrames and I'm assuming they work the same.
Have your form in frame 1 submit to itself and before you being output, check for any _POST or _GET data to indicate this is a form submission and not a fresh load.
If you have any form data, just pass it on to the script in the other frame via an onload attribute in the body tag. Here's an example:
Code: Select all
<?php
$type = $_GET['type'];
if (isset($_POST['submit']))
{
$post = base64_encode(serialize($_POST));
}
?>
<html>
<head>
</head>
<?
if (isset($post))
{
?>
<body onload="parent.parent.qresults.location.href='qresults.php?type=<?= $type ?>&query=<?= $post ?>';">
<?
}
else
{
?>
<body onload="parent.qtype.location.href='qtype.php?type=<? echo $type; ?>';">
<?
}
.
.
.
?>~Scott