如何在这个Php代码中纠正错误 [英] How Shld I Correct The Error Here In This Php Code
本文介绍了如何在这个Php代码中纠正错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
注意:未定义的索引:第9行的E:\ xampp \ htdocs \tnou \ forum \ login.php中的studentid
注意:未定义的索引:第9行的E:\ xampp \ htdocs \tnou \ forum \ login.php中的adminid
注意:未定义的索引:staffid in E:\ xampp\htdocs \tnou \ forum \ login.php第9行
代码:
Notice: Undefined index: studentid in E:\xampp\htdocs\tnou\forum\login.php on line 9
Notice: Undefined index: adminid in E:\xampp\htdocs\tnou\forum\login.php on line 9
Notice: Undefined index: staffid in E:\xampp\htdocs\tnou\forum\login.php on line 9
Code :
<?php
session_start();
require_once("forumtop.php");
include '../include/alljs.php'; /* this file contains all javascript function used in the project */
include '../include/allfunction.php';
/* if user already logged in then no need to display login form. so we redirect to index.php */
if($_SESSION['studentid']!=null || $_SESSION['adminid']!=null || $_SESSION['staffid']!=null)
{
$url = "index.php";
redirect($url);
}
?>
<h1 align="center">Welcome to TNOU Student Forum</h1><br><br>
<form id="ContactForm" action="loginprocess.php" method="post">
<table width="100%" border="0">
<tr>
<th colspan="2" align="center"><h2>Student Login</h2></th>
</tr>
<tr>
<td width="50%" align="right">Enrollment No.:</td>
<td width="50%" align="left">
<div class="bg">
<input type="text" name="txtenrolment"></div>
</td>
</tr>
<tr>
<td width="50%" align="right">Password:</td>
<td width="50%" align="left">
<div class="bg">
<input type="password" name="txtpassword" id="txtpwd"></div>
<label>
<input type="checkbox" name="pwdchk" id="pwdshw" onClick="pwdShow('txtpwd','pwdshw');">Show Password
</label>
</td>
</tr>
<tr>
<td width="50%" align="right"> </td>
<td width="50%" align="left">
<label>
<a class="button"><span><span>
<input type="submit" value="Login">
</span></span>
</label>
</td>
</tr>
<tr>
<td width="50%" align="right"> </td>
<td width="50%" align="left">
<a href="../common/forgetpassword.php?tbl=forum_member">Forget Password ?</a>
</td>
</tr>
<tr>
<td width="50%" align="right"> </td>
<td width="50%" align="left">
<a href="newmember.php">Not a member ? Register Now</a>
</td>
</tr>
<tr>
<?php
if(isset($_GET['msg']))
{
$val=$_GET['msg'];
if($val==1)
{
$msg = "Student Login Required for using these feature..!!";
$msgcolor="green";
}
else if($val==2)
{
$msg = "Enrollment No. or password incorrect. Please re-enter..!!";
$msgcolor="red";
}
else if($val==3)
{
$msg = "You are Logged out Successfully!";
$msgcolor="green";
}
else if($val=="membershipsuccess")
{
$msg = "Your Membership process completed successfully!";
$msgcolor = "green";
}
echo '<td colspan="2" align="center"><h3 style="color:'.$msgcolor.';">'.$msg.'</h3></td>';
}
?>
</tr>
</table>
</form>
<?php
require_once("forumbottom.php");
?>
推荐答案
_SESSION['studentid']!=null ||
_SESSION['studentid']!=null ||
_SESSION['adminid']!=null ||
_SESSION['adminid']!=null ||
_SESSION['staffid']!=null)
{
_SESSION['staffid']!=null) {
这篇关于如何在这个Php代码中纠正错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文