By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,949 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,949 IT Pros & Developers. It's quick & easy.

POSTing through frames

P: n/a
Ike
I have what is perhaps a stupid problem. I have a form where users enter
values (call this page1.php), and these then need to be POSTed to a page
(page2.php) (code at bottom of this posting), that calls up a page with two
frames (page3a.php and page3b.php) BUT, I need the values that the user
entered in page1.php to be visible to page3a.php and page3b.php.

When I submit from page1.php (running apache btw) I get "Method Not
Allowed -- The requested method POST is not allowed for the URL /page2.php."

Can anyone please tell me how to get this values posted from page1.php. to
the targets where I need those values in page3a.php and page3b.php? Thanks,
Ike

This is page2.php:
<HTML>
<HEAD>
<TITLE>VIOS Demonstration</TITLE>

</HEAD>
<frameset rows="360,*">
<frame src="page3a.php" name="top" scrolling="no"
noresize FRAMEBORDER="0" BORDER="0" FRAMESPACING="0" marginwidth="1"
marginheight="1">
<frame src="page3b.php" name="bottom" marginwidth="1"
scrolling="no" noresize FRAMEBORDER="0" BORDER="0" FRAMESPACING="0"
marginheight="1">

<noframes>
<body>
<p>
<p>This web page uses frames, but your
browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</HTML>
Mar 3 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Here's a couple of ways to pass values.

1) using querystring
=============

page1.php :
<form method="post" action="page2.php">
<input type="text" name="t1" value="hello">
<input type="text" name="t2" value="world">
<input type="submit" value="submit">
</form>
frameset :
<?php
$t1='';
$t2='';
if($_POST){
$t1 = $_POST['t1'];
$t2 = $_POST['t2'];
}
?>
<frame src="page3a.php?t1=<?php echo urlencode($t1); ?>">
<frame src="page3b.php?t2=<?php echo urlencode($t2); ?>">
page3a.php :
<?php
if(isset($_GET['t1'])){
echo $_GET['t1'];
}
?>
page3b.php :
<?php
if(isset($_GET['t2'])){
echo $_GET['t2'];
}
?>
2) using SESSION
============

page1.php :
[same code]
frameset :
<?php
if($_POST){
session_start();
$_SESSION['t1'] = $_POST['t1'];
$_SESSION['t2'] = $_POST['t2'];
}
?>
page3a.php :
<?php
session_start();
if(isset($_SESSION['t1'])){
echo $_SESSION['t1'];
}
?>
page3b.php :
<?php
session_start();
if(isset($_SESSION['t2'])){
echo $_SESSION['t2'];
}
?>

Mar 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.