PHP联系表单问题

时间:2017-02-04 19:39:25

标签: php html post contact-form

我在将联系表单中的结果发送到电子邮件地址时遇到了一些麻烦。我点击提交,我的PHP脚本告诉我它已成功...但没有任何东西打到我的邮箱。请有人能告诉我我做错了什么。



<!doctype html>

<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Contact - James Novis Tuition</title>
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link rel="stylesheet" type="text/css" href="css/mobile.css" media="screen and (max-width : 568px)">
	<script type="text/javascript" src="js/mobile.js"></script>
</head>
<body>
	<div id="header">
		<a href="index.html" class="logo">
			<img src="images/logo.jpg" alt="">
		</a>
		<ul id="navigation">
			<li class="selected">
				<a href="index.html">Home</a>
			</li>
			<li>
				<a href="about.html">About</a>
			</li>
			<li>
				<a href="payment.html">Payment Details</a>
			</li>
			<li>
				<a href="availability.html">Availability</a>
			</li>
			<li>
				<a href="Timetable2017.pdf" target="_blank">Timetable 2016/17</a>
			</li>
			<br><br>
			<li>
				<a href="termsandconditions.pdf" target="_blank">Terms and Conditions</a>
			</li>
			<li>
				<a href="contact.html">Contact</a>
			</li>
			<li>
				<a href="links.html">Links</a>
			</li>
			<li>
				<a href="contact.html">Acknowledgments</a>
			</li>
		</ul>
	</div>
	<div id="body">
		<h1><span>let's keep in touch</span></h1>
		<form action="sendemail.php" method="post">
			<input type="text" name="fname" id="fname" value="name">
			<input type="text" name="email" id="email" value="email">
			<input type="text" name="phone" id="phone" value="phone number">
			<textarea name="message" id="message">message</textarea>
			<input type="submit" name="send" id="send" value="send">
		</form>
	</div>
	<div id="footer">
		<div>
			<p>&copy; 2017 by James Novis. All rights reserved.</p>
			<ul>
				
				<li>
					<a href="https://www.facebook.com/jamesnovistuition/" id="facebook">facebook</a>
				</li>
				
			</ul>
		</div>
	</div>
</body>
</html>
&#13;
&#13;
&#13;

&#13;
&#13;
My php is as follows:

<?php
$from = "jamesnovistuition@gmail.com";
$to = "jamesnovistuition@gmail.com";
$content ="Sent from jamesnovis.com website";
$name = Trim(stripslashes($_POST['fname']));
$email = Trim(stripslashes($_POST['email']));
$phone = Trim(stripslashes($_POST['phone']));
$message = Trim(stripslashes($_POST['message']));


$body = "";
$body .="Name: ";
$body .=$name;
$body .="\n";
$body .="Email: ";
$body .=$email;
$body .="\n";
$body .="Telephone Number: ";
$body .=$phone;
$body .="\n";
$body .="Message: ";
$body .=$message;
$body .="\n";

$subject = $content;

$go = mail($to, $subject, $body, "From:<$from>");

if($go) {
	print("Success!");
}
else {
	print("Unable to send!!");
}
&#13;
&#13;
&#13;

&GT;

0 个答案:

没有答案