Posted by zorro on 03/04/07 16:01
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'];
}
?>
Navigation:
[Reply to this message]
|