Page 1 of 1

Session not woking on page 3 can you help

Posted: Mon Oct 03, 2005 8:33 pm
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;">

Posted: Mon Oct 03, 2005 8:37 pm
by feyd
I don't believe it was necessary to create a new thread for the same issue. :?