Hello there,
I want to redirect a page and send the form variables on the redirected page.
I know method of passing variables through url.
But is there any other way to to do the same.
Could anyone suggest something???
Thanx in advance.
Redirecting to a page
Moderator: General Moderators
Sessions?
page1.php
page2.php
page3.php
page1.php
Code: Select all
<?php
//FORM
session_start();
echo "
<FORM METHOD=POST ACTION=page2.php>
<INPUT TYPE=TEXT NAME=A>
</FORM>
";
?>Code: Select all
<?php
//REDIRECT
session_start();
$_SESSION['A'] = $A;
header("location: page3.php");
?>Code: Select all
<?php
//ECHO
session_start();
echo $_SESSION['A'];
?>Note about the previous example:
should be changed to
Also, there should be double quotes around certain things in the html part of it. Example
should be changed to
Code: Select all
$_SESSION['A'] = $A;Code: Select all
$_SESSION['A'] = $_POST['A'];Code: Select all
<INPUT TYPE=TEXT NAME=A>Code: Select all
<INPUT TYPE="TEXT" NAME="A">