Php 忽略了的错误抑制,未定义索引
我有一个带有Php 忽略了的错误抑制,未定义索引,php,wamp,Php,Wamp,我有一个带有 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Login Page</title>
<style type="text/css">
h2 {letter-spacing: 10px; font-size: .2in; background-color: #33CC00; color: #000000; text-transform:uppercase; width:260px}
span {color: #FF00CC}
legend {font-variant: small-caps; font-weight: bold}
fieldset {width: 260px; font-family: "Times New Roman", Times, serif; background-color: #CCCCCC; color: #000000}
label {display:block;}
.placeButtons {position: relative; left: 0px; width: 70px; margin: 5px; 0px;}
</style>
</head>
<body>
<h2>Login Page</h2>
<form name="loginform" action='successfullogin.php' method='POST'>
<fieldset>
<legend>Form</legend>
<label>Username: <input type="text" name="username"/><span>*</span></label> <br/>
<label>Password: <input type="password" name="pass"/><span>*</span></label>
<input class="placeButtons" type="reset" value='Reset'/>
<input class="placeButtons" type="submit" value='Login'/>
<a href='register.php'>Register</a>
</fieldset>
</form>
</body>
</html>
我的问题首先是我遗漏了什么,其次是这个错误的含义是什么。因为我已经看过很多次了。这不是一个错误,而是一个通知。它告诉您,
$\u POST['submit']
等没有填写,这是有道理的,因为您没有向他们发布任何内容。这不是错误,而是通知。它告诉您,$\u POST['submit']
等没有填写,这是有道理的,因为您没有向他们发布任何内容。首先检查表单是否已提交,然后再进行处理
<?php
if( isset($_POST) ){
$submit = $_POST['submit'];
$fullname = strip_tags($_POST['fullname']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date = date("Y-m-d");
}
?>
首先检查表单是否已提交,然后进行处理
<?php
if( isset($_POST) ){
$submit = $_POST['submit'];
$fullname = strip_tags($_POST['fullname']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date = date("Y-m-d");
}
?>
在使用任何变量之前,您可以在任何地方使用isset()函数。在使用任何变量之前,您可以在任何地方使用isset()函数。
<?php
if( isset($_POST) ){
$submit = $_POST['submit'];
$fullname = strip_tags($_POST['fullname']);
$username = strip_tags($_POST['username']);
$password = strip_tags($_POST['password']);
$repeatpassword = strip_tags($_POST['repeatpassword']);
$date = date("Y-m-d");
}
?>