I have two forms that i get user input from. form one is "index.php" which goes to form two "select.php. i use "options.php" to display some content and i plan on using the user input in the displays. the problem i am facing is that even though i have session_start(); on all three pages none of my variables pass through. i have done a var_dump($_SESSION); and echo $_SESSION; i even used session_regenerate_id(TRUE);
index.php session variables
if(isset($_POST['login'])){
$_SESSION['name'] = $_POST['name'];
$_SESSION['surname'] = $_POST['surname'];
$_SESSION['email'] = $_POST['email'];}
select.php session variables
if(isset($_POST['submit'])){
$_SESSION['checkIn'] = $_POST['checkIn'];
$_SESSION['checkOut'] = $_POST['checkOut'];
$_SESSION['islandList'] = $_POST['islandList'];
}
Below are the 3 headers of each page
<?php
//index.php page 1
session_start();
?>
<?php
if(!isset($_POST['name'], $_POST['surname'], $_POST['email'])){?>
// basic html form goes here.
<?php }
if(isset($_POST['login'])){
$_SESSION['name'] = $_POST['name'];
$_SESSION['surname'] = $_POST['surname'];
$_SESSION['email'] = $_POST['email'];}
?>
<?php
//select.php page 2
session_start();
echo $_SESSION['name']; // session variable does not go through
echo $_SESSION['surname']; // session variable does not go through
echo $_SESSION['email']; // session variable does not go through
?>
<?php
if(isset($_POST['submit'])){
$_SESSION['checkIn'] = $_POST['checkIn'];
$_SESSION['checkOut'] = $_POST['checkOut'];
$_SESSION['islandList'] = $_POST['islandList'];
}
var_dump($_SESSION);
?>
<?php
// options.php page 3
session_start();
require_once 'rateCalc.php';
?>
<?php
echo $_SESSION; // session variables do not go through
var_dump($_SESSION); // session variables do not go through
?>
I am still very new to this. but from everything i have looked at i havent been able to see where i made a mistake. this happens across all 3 browsers. firefox, chrome and microsoft edge. i have checked cookies, checked session ids and it still wont work. another thing is, when i try use for example echo $_SESSION['islandList'] the variables wont pulkl through but if i use $_POST['islandList'] it sometimes works and from my lessons and notes i am under the impression that it is not supposed to worklike that in this instance. i havent managed to find a solution online. gone through about 20 sites via google.