嘿,伙计,我创建了这个表格,它可以滑出,您可以与它联系,它位于标题中。出于某种原因,如果我提交它,它告诉我找不到页面 - 我创建了一个页面并给了它一个发送电子邮件的模板。如果我只是点击没有值的提交按钮,它会转到带有感谢信息的页面。
联系代码:
<div id="feedback"><!-- Sliding contact form ---->
<form method="post" action="../contactformsubmit">
<h2>Phone: 847-782-9816</h2>
<p><label>Name: </label><input type="text" name="name"/></p>
<p><label>Email: </label><input type="text" name="email"/></p>
<p><label>Subject: </label><input type="text" name="subject"/></p>
<p><label>Message: </label><textarea name="message"></textarea></p>
<p><input type="submit" value="Send" class="btn"/></p>
</form>
<a href="#" class="pull_feedback" title="Click to leave feedback" ><img src=""/>Feedback</a>
</div>
<!-- end contact form -->
模板代码:
<?php
/*
Template Name: formsubmit
*/
session_start();
get_header(); ?>
<style>
.item-post{
margin: 0 0 1.625em;
padding: 0 0 1.625em;
position: relative;
float: left;
height: 365px;
width: 100%;
margin-left: 2%;
}
.singular .item-post{
text-align:center;
}
.singular.page .hentry {
padding:0 0 0 0;
width: 17%;
margin-top:1em;
//height: 405px;
}
.singular.page .hentry:hover{
background: #C9191B;
}
.singular .entry-title {
font-size: 15px;
width: 100%;
text-align: center;
}
.singular .entry-content {
width:100%;
}
.singular .entry-header {
width:100%;
text-align:center;
}
.singular .discription {
width: 80%;
text-align: left;
font-size: 12px;
padding-left: 15%;
height: 12%;
}
.singular .prodslideshow {
display:none;
}
.singular .pricing {
padding-left: 15%;
}
</style>
<div id="primary">
<div id="content" role="main">
<div class="thankyou" style="text-align:center; padding-top:1em; padding-bottom:1em;">
<h2>Thank you for contacting us! We are here to make sure your time with us is a good one! We will contact you as soon as we can.</h2>
</div>
<?php
$message = $_POST['message'];
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
/*******SEND EMAIL**********/
require_once "Mail.php";
$body = "
Message from contact form!
$name
$email
$message
";
// Send
$from = "Contact Form ";
//$to = "";
$to = "";
$host = "";
$username = "";
$password = "";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>