如何解决如何拒绝在 php 中发帖?
我希望我的 PHP 文件不要发布到我实际编写的网站上。如果所有输入都已填写,我如何发布网站?
我的 index.PHP
<!doctype html>
<html lang="en">
<head>
<Meta charset="utf-8">
<title>Form Validation</title>
<Meta name="description" content="The HTML5 Herald">
<Meta name="author" content="SitePoint">
<style>
#inp1{
margin-bottom: 3px;
}
#first{
margin-bottom: 20px;
}
#second{
margin-bottom: 10px;
}
</style>
</head>
<body>
<section>
<h1>PHP Form Validation</h1>
<div>
<form action="post.PHP" method="post">
<div id="first">
Name: <input type="text" name="name" id="inp1" autocomplete="off"><br>
Email: <input type="text" name="email" id="inp1" autocapitalize="off"><br>
Password: <input type="password" name="pwd" id="inp1"><br>
Repeat Passowrd: <input type="password" name="pwdrepeat">
</div>
<div id="second">
Gender:
<input type="radio" name="gender" value="female">Female
<input type="radio" name="gender" value="male">Male
<input type="radio" name="gender" value="other">Other
</div>
<button type="submit" name="submit">Submit</button>
<?PHP
if (isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['pwd'];
$passwordRe = $_POST['pwdrepeat'];
$gender = $_POST['gender'];
if (!empty($name) && !empty($email) && !empty($password) && !empty($passwordRe) && !empty($gender)){
if ($password === $passwordRe){
echo "<p style='color:green;'>Successfully submitted!</p>";
}else{
echo "<p style='color: red'>Your password is not equal to the other</p>";
}
}else {
echo "<p>Please fill all the inputs</p>";
}
}
?>
</form>
</div>
</section>
</body>
<?PHP
if (isset($_POST['submit'])){
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['pwd'];
$passwordRe = $_POST['pwdrepeat'];
$gender = $_POST['gender'];
if (!empty($name) && !empty($email) && !empty($password) && !empty($passwordRe) && !empty($gender)){
if ($password === $passwordRe){
echo "<p style='color:green;'>Successfully submitted!</p>";
}else{
echo "<p style='color: red'>Your password is not equal to the other</p>";
}
}else {
echo "<p>Please fill all the inputs</p>";
}
}
?>
我正在开发一个测验应用程序并最近开始使用 PHP,但我不知道如何拒绝在 PHP 中发帖。 Stackoverflow 说你必须添加更多细节并写一些关于你的问题的东西,但我没有什么可写的,这就是为什么我现在要写一些东西。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。