我编写了一个自定义registration.php文件,该文件旨在验证表单输入并将新用户提交给用户数据库。我正在尝试使用自定义Wordpress页面,如下所示:
<form action="wp-content/plugins/registration/register.php" method="post">
<div class="form-group">
<label for="inputUsername">Username</label>
<input type="text" class="form-control" id="inputUsername">
</div>
<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" class="form-control" id="inputPassword">
</div>
register.php文件如下所示:
<?php
// Initialise variables
$name = "";
$password = "";
$email = "";
$phone = "";
$how = "";
$type = "";
// Sanitise fields
if($_SERVER["REQUEST_METHOD"] == "POST")
{
$name = test_input($_POST["inputUsername"]);
$password = test_input($_POST["inputPassword"]);
$email = test_input($_POST["inputEmail"]);
$phone = test_input($_POST["inputPhone"]);
$how = test_input($_POST["inputHow"]);
$type = test_input($_POST["inputType"]);
}
?>
我正在努力访问它 - 我找不到404。我应该尝试像这样进行自定义用户注册吗?或者,还有更好的方法?我想避免将所有PHP代码放在带有HTML的页面中。