我无法在代码中找到错误。我的PHP代码在我的index.html文件中。我无法从静态网页发送消息。
HTML代码:
<div class="col-md-6">
<form action="index.html" method="POST" class="contact-form" role="form">
<input type="text" class="form-control" id="fname" name="fname" placeholder="Your Full Name">
<input type="email" class="form-control" id="email" name="email" placeholder="Your E-mail">
<input type="text" class="form-control" id="subj" name="subj" placeholder="Your Subject">
<textarea id="mssg" name="mssg" placeholder="Your Message" class="form-control" rows="10"></textarea>
<input class="btn btn-main btn-lg" type="submit" id="submit" name="submit" data-loading-text="<i class='fa fa-spinner fa-spin'></i> Sending...">
</form>
</div>
PHP代码:
<?php
if (isset($_POST['submit'])) {
$to = 'email@company.com';
$siteName = 'http://www.website.com';
$name = $_POST['fname'];
$mail = $_POST['email'];
$subject = $_POST['subj'];
$message = $_POST['mssg'];
$mailSub = '[Contact] [' . $siteName . '] '.$subject;
$body = 'Sender Name: ' . $name . "\n\n";
$body .= 'Sender Mail: ' . $mail . "\n\n";
$body .= 'Message Subject: ' . $subject . "\n\n";
$body .= 'Message: ' . $message;
$header = 'From: ' . $mail . "\r\n";
$header .= 'To: ' . $to . "\r\n";
mail($to, $mailSub, $body, $header);
}else{
echo '0';
}
?>
每次尝试通过我的网站发送消息时都会收到错误消息。谢谢!
答案 0 :(得分:2)
如果您没有指示系统将# Configure the Microsoft Azure Provider
provider "azurerm" {
subscription_id = "..."
client_id = "..."
client_secret = "..."
tenant_id = "..."
}
# Create a resource group
resource "azurerm_resource_group" "production" {
name = "production"
location = "West US"
}
# Create a virtual network in the web_servers resource group
resource "azurerm_virtual_network" "network" {
name = "productionNetwork"
address_space = ["10.0.0.0/16"]
location = "West US"
resource_group_name = "${azurerm_resource_group.production.name}"
subnet {
name = "subnet1"
address_prefix = "10.0.1.0/24"
}
subnet {
name = "subnet2"
address_prefix = "10.0.2.0/24"
}
subnet {
name = "subnet3"
address_prefix = "10.0.3.0/24"
}
}`enter code here`
文件视为PHP,那么查看action="index.html"
可能会出现问题。
如果没有,那么您需要将其更改为.html
文件扩展名并重命名当前文件以容纳它。然后将您的操作值更改为指向该文件。
例如:
.php
<form action="script.php" method="post">
是您现在的PHP处理程序。