这很难解释,但我在 PHP 中的 Post 变量方面遇到了一些问题。问题是我一直在 Repl.it 上制作一个虚拟网站来练习 PHP,因为我是一个完全的初学者,所以我一直在尝试联系表格。这是文件名“contact-form-handler.php”的 PHP 代码:
<?php
$name = $_Post["name"]; $visitor_email = $_Post["email"]; $message = $POST['message'];
$email_from = "19braja@rgshw.com";
$email_subject = "New Form Submission For BXRSTUDIOS";
$email_body = "User Name: $name.\n ".
"User Email: $visitor_email.\n".
"User Message $message.\n";
$to = "19braja@rgshw.com";
$headers = "From: $email_from \r\n";
$headers = "Reply-To: $visitor_email \r\n";
mail($to,$email_subject,$email_body,$headers);
header("Location: contact.html");
?>
这是文件名为“contact.html”的 HTML 代码:
<html>
<head>
<link href="contact.css" rel="stylesheet" type="text/css" />
<title>Contact Form</title>
</head>
<body>
<div class="contact-title">
<h1> Want To Contact Us?</h1>
<h2> We are always here to help</h2>
</div>
<div class="contact-form">
<form id ="contact=form" method="post" action="contact-form-handler.php">
<input name="name" type="text" class="form-control" placeholder="Your Name" required><br>
<input name="email" type="email" class="form-control" placeholder="Your Email" required><br>
<textarea name="message" type="text" class="form-control" placeholder="Message to BXRSTUDIOS" row="4" required></textarea><br>
<input type="submit" class="form-control submit" value="SUBMIT MESSAGE">
<p class="back">Not what you needed?<a href="index.php"> Go Back</a>
</p>
</form>
</div>
</body>
</html>
有谁知道为什么 Post 变量不起作用?这是控制台上的内容:
鸿蒙传说
相关分类