这是我的页面,当我运行它时,我得到了 excption,它说formSubmit
未定义。我知道我必须检查post
变量的内容但我不知道解决方案
<?php
if($_POST['formSubmit'] == "Submit")
{
$errorMessage = "";
if(empty($_POST['formPassword']))
{
$errorMessage .= "<li> You forgot to enter your password!</li>";
}
if(empty($_POST['formName']))
{
$errorMessage .= "<li> You forgot to enter a name!</li>";
}
$varPassword = $_POST['formPassword'];
$varName = $_POST['formName'];
if(empty($errorMessage))
{
require('Document1.php');
User::add_user($varName, $varPassword);
exit;
//header("Location: normal.php");
}
}
?>
<html>
<head>
<title>SIGN UP</title>
<style type="text/css">
<!--
.style1 {
font-size: xx-large;
color: #0000CC;
}
-->
</style>
</head>
<body>
<p align="center"><br>
<span class="style1">SIGN UP</span></p>
<p> </p>
<form action="myform1.php" method="post">
<p>
What is Your NAME ?<br>
<input type="text" name="formName" maxlength="50" value="" />
</p>
<p>
What is Your PASSWORD ?<br>
<input type="text" name="formPassword" maxlength="50" value="" />
</p>
<?php
/*
?>
<p>
What is Your Email ?<br>
<input type="text" name="formEmail" maxlength="50" value="" />
</p>
*/
?>
<input type="submit" name="formSubmit" value="Submit" />
<input type=reset value = "delete fields ">
</form>
</body>
</html>