我以前从未遇到过这种情况,临时没有 php,所以我尝试自己编写一个非常简单的代码。发送消息按钮似乎是一个链接,但不提交。你能不能帮我检查一下。这是HTML
<form method="post" action="contact.php">
<div class="row half">
<div class="6u">
<input name="name" placeholder="Name" type="text" class="text" />
</div>
<div class="6u">
<input name="email" placeholder="Email" type="text" class="text" />
</div>
</div>
<div class="row half">
<div class="12u">
<textarea name="message" placeholder="Message"></textarea>
</div>
</div>
<div class="row half">
<div class="12u">
<a href="#" class="button button-icon icon icon-envelope">Send Message</a>
</div>
然后我的php
<?php
$name = $_POST ['name'];
$email = $_POST ['email'];
$message = $_POST ['message'];
if(!$name || !$company || !$email)
{
echo "
<h2>Feedback</h2>
<form method='post' action='contact.php'>
Name: <br /><input name='name' type='text' value='$name' /><br /><br />
EMail: <br /><input name='email' type='text' value='$email' /><br /><br />
Message:<br />
<textarea name='message' cols='55' rows='8'>$message</textarea><br /><br />
<input type='submit' value='Send' />
</form>
<p>All fields are required</p>
";
exit;
}
$send_to = 'sean@seankonig.co.za'; // change to your email
mail($send_to, "Name: $name" , $message, "From: $email");
echo "Thank you for your feedback";
?>