Php 由于永久链接,联系人表单不起作用
我正在wordpress上工作,正在提交一份表格。由于永久链接的原因,我想它没有被提交。请参阅下面的代码:Php 由于永久链接,联系人表单不起作用,php,wordpress,forms,submit,permalinks,Php,Wordpress,Forms,Submit,Permalinks,我正在wordpress上工作,正在提交一份表格。由于永久链接的原因,我想它没有被提交。请参阅下面的代码: <?php /* Template Name: Contact */ get_header(); get_template_part('/functions/page-title'); ?> <style> textarea, input[type="text"] { width: 60%; max-width: 500px; box
<?php
/*
Template Name: Contact
*/
get_header();
get_template_part('/functions/page-title');
?>
<style>
textarea, input[type="text"] {
width: 60%;
max-width: 500px;
box-sizing: border-box;
height: 40px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
</style>
<link href="style.css" rel="stylesheet" type="text/css" />
<?php
// display form if user has not clicked submit
if (!isset($_POST["submit"])) {
echo("not postttttttttt");
echo(var_dump($_POST));
?>
<form method="post" >
<div id="content" align="center">
<div id="left-column">
<div>
<div class="page-title-block">
<h3 class="page-title"><a href="<?php the_permalink(); ?>"></a></h3>
</div>
<div align="center" class="copy clearfix">
<?php the_content(); ?>
<div align="center" style="position:relative; width900px; background-color:#454545; margin-top:20px; height:630px; ">
<div style="position:absolute; left:33px; top:30px; color:#fff; font-size:14px; ">All fields are required.</div>
<div style="position:absolute; left:34px; top:70px; color:#fff; font-weight:bold; font-size:15px; ">Full Name</div>
<textarea name="fullname" style="position:absolute; top:90px; left:30px; text-align:left;"></textarea>
<div style="position:absolute; left:34px; top:130px; color:#fff; font-weight:bold; font-size:15px; ">Phone Number</div>
<textarea name="phonenumber" style="position:absolute; top:150px; left:30px; text-align:left;"></textarea>
<div style="position:absolute; left:34px; top:190px; color:#fff; font-weight:bold; font-size:15px; ">Email Address</div >
<textarea name="emailaddress" style="position:absolute; top:210px; left:30px; text-align:left;"></textarea>
<div style="position:absolute; left:34px; top:250px; color:#fff; font-weight:bold; font-size:15px; ">Subject</div>
<div class="cleanf twi_disp" style="position:absolute; top:270px; left:30px; width:358px; height:44px; text-align:left; background:url(images/field_358_44.png); ">
<div id="fild1ov" style="position:absolute; font-size:16px; font-family:Arial, Helvetica, sans-serif; color:#666; left:10px; top:16px; ">
<select name="subject">
<option value="Select">Select</option>
<option value="technical">Technical issue</option>
<option value="commercial">Commercial issue</option>
</select>
</div>
</div>
<div style="position:absolute; left:34px; top:340px; color:#fff; font-weight:bold; font-size:15px; ">Description</div>
<div class="msg" style="position:absolute; top:360px; left:30px; text-align:left; background:url(images/field_760_162.png); ">
<textarea name="message" style="top:5px; left:4px; position:absolute;" class="msg"></textarea>
</div>
<input type="submit" value="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">
<div style="position:absolute; left:30px; top:560px; color:#fff; font-size:14px; ">Please check your spam/junk folder if you do not receive a reply within the next 24 hours.</div>
</div>
</div>
</div>
</div>
</form>
<?php
} else { // the user has submitted the form
// Check if the "fullname" input field is filled out
echo('qqqqqqqqqqqqqqqqq');
if (isset($_POST["fullname"])) {
echo('sssssssssssssss');
$fullname = $_POST["fullname"];
$phonenumber = $_POST["phonenumber"]; // sender
$subject = $_POST["subject"];
$message = $_POST["message"];
// message lines should not exceed 70 characters (PHP rule), so wrap it
$message = wordwrap($message, 70);
$to = "mohamed.kazma@windowslive.com";
wp_mail( $to, $subject, $message, $headers, $attachments );
}
}
?>
<?php get_footer(); ?>
text区域,输入[type=“text”]{
宽度:60%;
最大宽度:500px;
框大小:边框框;
高度:40px;
-webkit边界半径:5px;
-moz边界半径:5px;
边界半径:5px;
}
所有字段都是必填字段。
全名
电话号码
电子邮件地址
主题
挑选
技术问题
商业发行
描述
如果您在接下来的24小时内没有收到回复,请检查您的垃圾邮件/垃圾邮件文件夹。
当按下submit按钮时,代码没有进入php代码段,它应该在那里发送am电子邮件,因为我知道当我将邮件代码放在页面的开头时,我能够发送电子邮件。
加上当我放入echo(var_dump($_POST));值已正确填写。您忘记输入提交的名称属性 您的代码:
<input type="submit" value="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">
<input type="submit" value="submit" name="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">
修改代码:
<input type="submit" value="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">
<input type="submit" value="submit" name="submit" class="round-button" style="top:520px; left:30px; border-radius:5px;">
为了清楚起见,在发布表单时,会显示此部分:
echo('qqqqqqqq')代码>但这部分不是<代码>回波('sssssss')代码>