嗨,大家好,我有一個問題,我希望你們可以幫忙,我打字的所有領域,然後按提交我只是「錯誤!」在我的屏幕上。聯繫表格提交錯誤
請參閱代碼:
HTML
<h2 class="formhead">Contact Form</h2>
<br>
<form class="form" action="mail.php" method="POST">
<p class="name">
<input type="text" name="name" id="name" placeholder="John Doe" />
<label for="name">Name</label>
</p>
<br>
<p class="email">
<input type="text" name="email" id="email" placeholder="[email protected]" />
<label for="email">Email</label>
</p>
<br>
<p class="number">
<input type="text" name="number" id="number" placeholder="0774XXXXXXX" />
<label for="name">Contact Number</label>
</p>
<br>
<p class="web">
<input type="text" name="web" id="web" placeholder="www.example.co.uk" />
<label for="name">Website</label>
</p>
<br>
<p class="message">
<textarea name="message" id="message" placeholder="Write something to us" /> </textarea>
</p>
<br>
<p class="submit">
<input type="submit" value="Send"/>
</p>
</form>
PHP
<?php $name = $_POST['name'];
$email = $_POST['email'];
$number = $_POST['number'];
$message = $_POST['message'];
$website = $_POST['web'];
$formcontent="From: $name \n Contact: $number \n Website: $web \n Message: $message";
$recipient = "[email protected](hidden)y.co.uk";
$subject = "Contact Form";
$mailheader = "From: $email ";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You!" . " -" . "<a href='contact.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>";
?>
任何幫助,將不勝感激!
感謝
山姆
你得到''的錯誤,因爲這是你的郵件聲明中的「或死亡」的一部分!切換顯示實際的錯誤。 –
@DigitalChris我在猜測它的'die(「Error!」);' – Scuzzy
添加特定的die消息,專門用於開發。例如:die(「Error a」);死(「錯誤b」); – ilarsona