Reputation: 215
I have a site on my localhost that i am using session variables on.
This is the first page where I defined the session variable for the username: Newcust.php
<?php
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php
$mysqli = mysqli_connect("localhost", "root", "", "bms");
if (mysqli_connect_errno())
{
printf("Connection Failed: %s\n", mysqli_connect_errno());
exit();
}
else
$_Session ['uname'] = $_POST['uname'];
$pword = $_POST['pword'];
$enc = sha1($pword);
echoing the session variable back on the same page returns the correct username. When I try to use the $_Session ['uname'] variable on the next page of the site, it does not register at all.
insert customer.php
<?php
session_start();
echo "hello " .$_Session ['uname'];
?>
Could this be a server issue? I am running Apache on my macbook and haven't had a problem with php yet.
Upvotes: 2
Views: 2100