Page 1 of 1

Redirecting to a page

Posted: Sat Aug 30, 2003 7:14 am
by prismngp
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.

Posted: Sat Aug 30, 2003 8:37 am
by Drachlen
Sessions?

page1.php

Code: Select all

<?php
//FORM
session_start();

echo "
<FORM METHOD=POST ACTION=page2.php>
<INPUT TYPE=TEXT NAME=A>
</FORM>
	";
?>
page2.php

Code: Select all

<?php
//REDIRECT
session_start();
$_SESSION['A'] = $A;
header("location: page3.php");	
?>
page3.php

Code: Select all

<?php
//ECHO
session_start();
echo $_SESSION['A'];
?>

Posted: Sat Aug 30, 2003 9:57 am
by JAM
Note about the previous example:

Code: Select all

$_SESSION['A'] = $A;
should be changed to

Code: Select all

$_SESSION['A'] = $_POST['A'];
Also, there should be double quotes around certain things in the html part of it. Example

Code: Select all

<INPUT TYPE=TEXT NAME=A>
should be changed to

Code: Select all

<INPUT TYPE="TEXT" NAME="A">

Posted: Sat Aug 30, 2003 1:13 pm
by macewan
and for 508 compliance you should use <label> for that input :-]