注意:未定义的变量:_SESSION in“”在第9行 [英] Notice: Undefined variable: _SESSION in "" on line 9
本文介绍了注意:未定义的变量:_SESSION in“”在第9行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的PHP代码:
<?php include("inc/incfiles/header.inc.php")?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Index</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Welcome <?php echo ($_SESSION['SESS_fname']);?></h1>
<a href="member-profile.php">My Profile</a> | <a href="logout.php">Logout</a>
<p>This is a password protected area only accessible to members. </p>
</body>
</html>
我知道我的错误代码,但我不知道如何解决它。我的错误说:注意:未定义的变量:_SESSION在C:\xampp\htdocs\Smasher\member-index.php第9行
I know something I wrong with the code but I don't know how to fix it. My error says: "Notice: Undefined variable: _SESSION in C:\xampp\htdocs\Smasher\member-index.php on line 9"
如何我可以修复错误,以便用户的名字? mySQL数据库表中的第一个名称叫做$ code> fname 。
How can I fix the error so it will say the user's first name? The first name in the database table on mySQL is called fname
.
推荐答案
添加
session_start();
在任何HTML之前的页面开头
at the beginning of your page before any HTML
你将会有一些类似的东西:
You will have something like :
<?php session_start();
include("inc/incfiles/header.inc.php")?>
<html>
<head>
<meta http-equiv="Content-Type" conte...
这篇关于注意:未定义的变量:_SESSION in“”在第9行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文