Session not woking on page 3 can you help

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
andrew123
Forum Newbie
Posts: 3
Joined: Sun Oct 02, 2005 4:40 pm

Session not woking on page 3 can you help

Post by andrew123 »

session ..cant get it to work on page 3 it will not display anyhting on page 3
whhat i do wrong
page1.php

Code: Select all

// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
// Get the user's input from the form
   $1 = $_POST['1'];
   $2 = $_POST['2'];
   $3 = $_POST['3'];
// Register session key with the value
   $_SESSION['1'] = $1;
   $_SESSION['2'] = $2;
   $_SESSION['3'] = $3
;


<form action="page2.php" method="post">
<input name="1" type="radio" value="1">1
<br>
<input name="2" type="radio" value="2">2
<br>
<input name="3" type="radio" value="3">3

<input type="submit" value="Next &raquo;">
page2

Code: Select all

<?php
// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
// Get the user's input from the form
   $1 = $_POST['1'];
   $2 = $_POST['2'];
   $3 = $_POST['3'];
// Register session key with the value
   $_SESSION['1'] = $1;
   $_SESSION['2'] = $2;
   $_SESSION['3'] = $3
;

if ($_POST['1'] == 'true') {

echo $_SESSION['1'];
echo $_SESSION['2'];
echo $_SESSION['3'];

}?>
<form action="page3.php" method="post">
<input name="a" type="radio" value="a">a
<br>
<input name="b" type="radio" value="b">b

<input type="submit" value="Next &raquo;">


page3

Code: Select all

<?php
// start the session
session_start();
header("Cache-control: private"); //IE 6 Fix
// Get the user's input from the form
   $1 = $_POST['1'];
   $2 = $_POST['2'];
   $3 = $_POST['3'];

   $a = $_POST['a'];
   $b = $_POST['b'];
// Register session key with the value
   $_SESSION['1'] = $1;
   $_SESSION['2'] = $2;
   $_SESSION['3'] = $3

    $_SESSION['a'] = $a
     $_SESSION['b'] = $b
;


echo $_SESSION['1'];
echo $_SESSION['2'];
echo $_SESSION['3'];

echo $_SESSION['a'];
echo $_SESSION['b'];

}
?>
<form action="page4.php" method="post">
<input name="c" type="radio" value="c">c
<br>
<input name="c" type="radio" value="c">d

<input type="submit" value="Next &raquo;">
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I don't believe it was necessary to create a new thread for the same issue. :?
Post Reply