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!
At present I'm using $_SESSION['UserName'] to create and store the login details. But I'm not able to access this session variable. Is there any way for the website to remember these details?
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "LoginOK.php"
session_start();
session_register("myusername");
session_register("mypassword");
$_SESSION['loginname'] = $myusername;
//echo $_session['loginname'];
header("location:index.php");
}
I'm using <?php echo $_session['loginname']; in index.php. Is there anything wrong with the code?
<?php
session_start(); // You must call this function before using $_SESSION. It loads the data into $_SESSION.
echo $_SESSION['loginname']; // The name is all upper case
<?php
session_start(); // You must call this function before using $_SESSION. It loads the data into $_SESSION.
echo $_SESSION['loginname']; // The name is all upper case