Sorry but I'm new to this. The following code only displays 'Please login'. Code does work but it's not doing what I want it to, I'm trying to store userid in a session. Here is my code
<?php
if(!isset($_SESSION)) session_start();
if(isset($_POST['userid'])){
$userid = $_POST['userid'];
$_SESSION['userid']=$userid;
echo "Welcome $_SESSION[userid]";
}
if (!isset($_SESSION['userid'])){
echo "Please login";
exit;
}
?>
echo "Welcome $_SESSION[userid]";must beecho "Welcome $_SESSION['userid']";it won't solve your problem