我如何摆脱通知:未定义的索引:C中的login_user: [英] How do I get rid of an notice: undefined index: login_user in C:
本文介绍了我如何摆脱通知:未定义的索引:C中的login_user:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的登录无效,我收到此错误。 cyah似乎摆脱它这里是我试过的PHP和HTML
我尝试过:
my login is not working and i am getting this error. cyah seem to get rid of it here is what i have tried both the php and html
What I have tried:
<pre><?php
include'db_server.php';
$login=$_POST['login_user'];
if(isset($login))
{
// capture the values from the form and store in php variable
$screenname=$_POST['screenname'];
$mypwd=$_POST['mypwd'];
include'db_server.php';
mysqli_select_db($conn, 'national_wonders');
$sql= "SELECT * FROM login WHERE $screenname='$screenname' AND mypwd = MD5('$mypwd')";
$result = mysql_query($conn, $sql) or die("ERROR:" .mysql_error($conn));
$rowcount=mysql_num_rows($result);
if($rowcount ==1)
{
echo"<script type=\"text/javascript\">
alert('Screenname and password does not exist!');
window.location=\"../xhtml/login.html\";
</script>";
}
else
{
echo"<script type=\"text/javascript\">
alert('Screenname and password does not exist!');
window.location=\"../xhtml/login.html\";
</script>";
}
mysqli_close($conn);
}
?>
这里是htmml代码
here is the htmml code
<pre><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title> Login </title>
<link rel="stylesheet" type="text/css" href="../css/stylesheet.css" />
</head>
<body>
<div id="container" >
<div id="header">
<img src="../images/header.jpg" alt="header" />
</div>
<div id="navbar">
<ul>
<li><a href="../index.html" id="tlinks" class="toplinks" >Homepage</a></li>
<li><a href="featureNationalWonders.html" id="thold" class="toplinks"> Feature National Wonders</a></li>
<li><a href="contact.html" id="linkhold" class="toplinks">Contact Us</a></li>
<li><a href="register_user.html" id="phold" class="toplinks"> Sign Up</a></li>
<li><a href="login.html" id="loglinks" class="toplinks"> Login</a></li>
<li><a href="aboutus.html" id="panlinks" class="toplinks"> About Us</a></li>
</ul>
<form method="post" id="search" action="..php/login.php" >
<div>
<input type="text" name="search" value=""/>
<input type="submit" value="Search"/>
</div>
</form>
</div>
<br/><br/>
<div id="contentArea">
<form method="post" id="login_user" action="../php/login_user.php" accept-charset='UTF-8'>
<fieldset>
<legend> Login Details</legend><br/><br/>
<label> Screen Name:</label>
<input type="text" size="40" id="screenname" name="screenname" /><br/><br/>
<label> Password:</label>
<input type="password" size="40" id="mypwd" name="mypwd" /><br/><br/>
<input type="button" name="login_user" value="Login" /> <input type="button" value="RESET" />
<p>
<a href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" /></a>
</p>
<p>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="border:0;width:88px;height:31px"
src="http://jigsaw.w3.org/css-validator/images/vcss-blue"
alt="Valid CSS!" />
</a>
</p>
</fieldset>
</form>
</div>
<div id="footerFix"></div>
<div id="footerbox">
<div id="footer" >
<div id="footerholder" >
<ul>
<li><a href="../index.html" class="toplinks" >Homepage</a></li>
<li><a href="featureNationalWonders.html" class="toplinks"> Feature National Wonders</a></li>
<li><a href="contact.html" class="toplinks">Contact Us</a></li>
<li><a href="register.html" class="toplinks"> Sign Up</a></li>
<li><a href="login.html" class="toplinks"> Login</a></li>
<li><a href="aboutus.html" class="toplinks"> About Us</a></li>
</ul>
</div>
</div>
</div>
</div>
</body>
</html>
推荐答案
login=
_POST['login_user'];
\tif(isset(
_POST['login_user']; if(isset(
login))
\t{
\t\t\t// capture the values from the form and store in php variable
这篇关于我如何摆脱通知:未定义的索引:C中的login_user:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文