我想让用户在单击提交按钮后继续进入下一页,而是在加载此页面时将用户重定向到下一页。此外,这段代码在标题上方的“else”语句上给了我错误。
<center>
<?php
include "functions.inc";
$datafile = "users.dat";
if (array_key_exists('submit', $_POST))
// Function to check the password length
{
$the_user = $_POST['newuser'];
var_dump($the_user);
$users = arrayfile_to_array($datafile);
// Validate user name and password
// If valid, save to the file of users
$users[] = $the_user;
array_to_arrayfile($users, $datafile);
}
else
{
if (!file_exists($datafile)) // Data file doesn't exist, so create it
{
$users = array();
array_to_arrayfile($users, $datafile);
}
else
{
$users = arrayfile_to_array($datafile);
}
else
{
if (array_key_exists('submit', $_POST))
{
header('Location: 04invoice.php');
}
}
?>
<form name="<?php $_SERVER["PHP_SELF"] ?>" method="post">
Username: <input type="text" name="newuser[username]">
<br>Password: <input type="text" name="newuser[password]">
<br>Confirm Password: <input type="text" name="newuser[confirm_password]">
<br>Email: <input type="text" name="newuser[mail]">
</select><br> <input type="submit" name="submit" value="Sign Up">
</form>
</center>