如何回显登录的特定用户的名字和姓氏?这是我的 checkLogin.php 代码:
$FirstName = $_POST['FirstName'];
$LastName = $_POST['LastName'];
$sql="SELECT * FROM myweekprofiles WHERE LastName='$LastName' and FirstName='$FirstName'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("FirstName");
session_register("LastName");
header("location:loginSuccess.php");
}else {
//This page will describe that the email/password is incorrect
}
这是 inc_header_User.php 的代码:
if(!isset($_SESSION['FirstName'])) {
echo "Hello";
}else{
$FirstName = $_SESSION['FirstName'];
}
我尝试在标题中回显 $FirstName,但我收到一条错误消息:
未定义变量:第 55 行 C:\wamp\www\MyWeek\includes\inc_header_User.php 中的 FirstName