正如标题所说,我正在构建一个注册页面,我正在按照教程并构建代码,并且由于某种原因而不是打印错误,它只是在 url 中发布,这是我的代码。
<?php include ("core/init.php"); ?>
<?php include ("includes/overall/header.php");
if (empty($_POST) === false) {
$required_fields = array('username', 'password', 'password_again', 'email');
foreach($_POST as $key=>$value) {
if (empty($value) && in_array($key, $required_fields) === true) {
$errors[] = 'Fields marked with an * are required';
break 1;
}
}
}
print_r($errors);
?>
<h1>Register</h1>
<form action="" method"post">
<ul>
<li>
Username*:<br>
<input type="text" name="username">
</li>
<li>
Password*:<br>
<input type="password" name="password">
</li>
<li>
Password Again*:<br>
<input type="password" name="password_again">
</li>
<li>
E-mail*:<br>
<input type="text" name="email">
</li>
<li>
<input type="submit" value="Register">
</li>
</ul>
</form>
<?php include ("includes/overall/footer.php") ; ?>