PHP Sessions not registering
I need to register 4 sessions to latter reuse on a conformation page. So far my codes is not saving the sessions, can anyone tell me why? Here is the code on the process script
<?php
//include functions file
include('functions.php');
//Start session
session_start();
//register sessions
session_register('fname');
session_register('lname');
session_register('cell');
session_register('time');
//register all temp names to the form postings
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$cell = $_POST['cell'];
$hr = $_POST['hr'];
$min = $_POST['min'];
$tstamp = $_POST['tstamp'];
//set the value of $temptime to deisplay on the thankyou page
$temptime = "$hr':'$min' '$tstamp";
//Check to make sure all form elements are filled, and that the time stamp is formatted properly. Then set the redirect url.
if($hr == '' or $min == '' or $fname == '' or $lname == '' or cell == '') {
$redirect = 'regfail.html';
}else{
if($tstamp == 'AM') {
if($hr == '1' or $hr == '2' or $hr == '3' or $hr == '4' or $hr == '5' or $hr == '6' or $hr == '7' or $hr == '8' or $hr == '9') {
$time = "0$hr:$min";
}else{
$time = "$hr:$min";
}
}else if($tstamp == 'PM') {
$temphr = $hr + 12;
$time = "$temphr:$min";
}
$redirect = 'thankyou.php';
}
//Register sessions
$_SESSION['fname'] = $fname;
$_SESSION['lname'] = $lname;
$_SESSION['cell'] = $cell;
$_SESSION['time'] = $time;
register($fname, $lname, $cell, $time);
header("Location: $base_dir/$redirect");
exit;
?>
Here is the portion of code that shows the conformation sentence:
Thank you <?php $_SESSION['fname']; ?>
<?php $_SESSION['lname']; ?>
for registering with our sms system.
You will receive your options at <?php $_SESSION['time']; ?>
at the following number: <?php $_SESSION['cell']; ?>