这是一个视图(一个状态的templateUrl),并且isset由于某种原因剂量正常工作..我在代码的底部通过传入if(isset($ _ POST [“submit”])){do这个} 。但它做到了这一点。我清楚地给它一个名称属性“提交”和一个类型属性“提交”。请帮忙谢谢:
<?php
var_dump($_GET);
require_once('PhpConsole.phar');
require_once('connection.php');
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
</head>
<body>
<div id="page">
<h1>Registration </h1>
<form method = "post">
<input type = "text" name = "username" placeholder = "Username"required/>
<br>
<input type = "text"name = "email" placeholder = "Email"required/>
<br>
<input type = "text" placeholder = "password" name = "password" required/>
<br>
<input type = "submit" name = "submit"/>
</form>
</div>
<?php
$username = $_POST["username"];
$email = $_POST["email"];
$password = $_POST["password"];
if(isset($_POST["submit"])){
$query = "INSERT INTO authe (authe.Email , authe.Password, authe.Username) VALUES ('".$email."', '".$password."' , '".$username."')";
if($result = $connection->query($query))
{
header("Location: http://localhost:8012/phpForm/login.php");
}
else{
echo "Something Went wrong...";
}
}
?>
</body>
</html>
答案 0 :(得分:0)
当我测试时,这个普通的PHP代码可以工作,
<!DOCTYPE html>
<html lang="en-US">
<head>
</head>
<body>
<div id="page">
<h1>
Registration
</h1>
<form method = "post">
<input type = "text" name = "username" placeholder = "Username"required/>
<br>
<input type = "text"name = "email" placeholder = "Email"required/>
<br>
<input type = "text" placeholder = "password" name = "password" required/>
<br>
<input type = "submit" name = "submit"/>
</form>
</div>
<?php
print_r($_POST);
if(isset($_POST["username"])){
$username = $_POST["username"];
}
if(isset($_POST["email"])){
$email = $_POST["email"];
}
if(isset($_POST["password"])){
$password = $_POST["password"];
}
if(isset($_POST["submit"])){
echo $username .PHP_EOL;
echo $email .PHP_EOL;
echo $password .PHP_EOL;
}
?>
</body>
</html>
现在,根据其他人的要求,请使用Angular组件发布非工作代码以进一步提供帮助。