Redirecting to a page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prismngp
Forum Newbie
Posts: 1
Joined: Sat Aug 30, 2003 7:14 am

Redirecting to a page

Post 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.
Drachlen
Forum Contributor
Posts: 153
Joined: Fri Apr 25, 2003 1:16 am

Post 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'];
?>
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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">
macewan
Forum Commoner
Posts: 97
Joined: Mon Jul 07, 2003 8:27 pm

Post by macewan »

and for 508 compliance you should use <label> for that input :-]
Post Reply