我正在尝试创建一个与计算机和移动设备兼容的 HTML5 联系表单,当我单击发送消息时,它会跳转到一个空白的白色屏幕。我确实收到了一封电子邮件,但它不包含任何信息。我对 PHP 很陌生。
对于 www.rare1.ca/test:
<!DOCTYPE html>
<html>
<head>
<title>Responsive HTML5/CSS3 template</title>
<meta charset="utf-8" />
<meta name = "viewport" content = "width=device-width, maximum-scale = 1, minimum- scale=1" />
<link rel="stylesheet" type="text/css" href="css/default.css" media="all" />
<link rel="stylesheet" href="css/flexslider.css" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css' />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>
<script src="js/jquery.flexslider.js"></script>
<script src="js/default.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div id="pagewidth">
<header id="header">
<div class="center">
<nav id="mainNav">
<ul>
<li class="active"><a href="#pagewidth"><span>gallery</span></a></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li><a href="#contactUs"><span>contact us</span></a></li>
</ul>
</nav>
</div>
</header>
<div id="content">
<section class="row">
<div class="center">
<h1><img src="img/logo.gif" width="142" height="78"></h1>
<strong class="subHeading">Coming soon</strong>
<div class="gallery">
<ul class="slides">
<li><img src="img/img-gallery.jpg" alt="image" /></li>
<li><img src="img/img-gallery2.jpg" alt="image" /></li>
<li><img src="img/img-gallery3.jpg" alt="image" /></li>
</ul>
</div>
<div class="buttons"></div>
</div>
</section>
<section id="contactUs" class="row grey">
<div class="center">
<h1>Contact Us</h1>
<strong class="subHeading">lorem ipsum dolor sit amet, consectetur adipiscing elit</strong>
<div class="columns">
<div class="half">
<form action="sendemail.php" class="form">
<fieldset>
<h2>Feedback form</h2>
<div class="formRow">
<div class="textField"><input type="text" name="Name" id="name" placeholder="Your name ..." /></div>
</div>
<div class="formRow">
<div class="textField"><input type="text" name="Email" id="email" placeholder="Your Email ..." /></div>
</div>
<div class="formRow">
<div class="textField"><textarea name="Message" cols="20" rows="4" placeholder="Your message ..."></textarea> </div>
</div>
<div class="formRow">
<button class="btnSmall btn submit right">
<span>Send Message</span>
</button>
</div>
</fieldset>
</form>
</div>
<div class="half">
<h2>How to find us</h2>
<div id="map">
<div class="imgHolder"><img src="img/map.jpg" alt="google map" /></div>
</div>
</div>
</div>
</div>
</section>
</div>
<footer id="footer">
<div class="center">
</div>
</footer>
</div>
</body>
</html>
<?php
// This is the script for sending email.
// change the email address below to your own email address.
$mailTo = 'info@rare1.ca';
$name = htmlspecialchars($_POST['Name']);
$mailFrom = htmlspecialchars($_POST['Email']);
$message_text = htmlspecialchars($_POST['Message']);
$headers = "From: $name <$mailFrom>\n";
$headers .= "Reply-To: $name <$mailFrom>\n";
$message = $message_text;
mail($mailTo, $subject, $message, $headers );
?>