如何使其工作在Wordpress中引导表格

时间:2018-08-04 05:46:30

标签: php wordpress contact-form

contact.php

<form id="contact-form" method="post" action="contactproces.php" class="closeForm">
    <div class="row">
        <div class="col-md-6">
            <div class="form-group">
                <input type="text" name="name" id="name" value="" class="form-control" placeholder="Your name" required="required">
            </div>
        </div>

        <div class="col-md-6">
            <div class="form-group">
                <input type="email" name="email" id="email" value="" class="form-control" placeholder="Your email" required="required">
            </div>
        </div>

        <div class="col-md-12">

            <div class="form-group">
                <input type="text" name="subject" id="subject" value="" class="form-control" placeholder="Subject" required="required">
            </div>
        </div>

        <div class="col-md-12">
            <div class="form-group">
                <textarea class="form-control" name="message" id="message" placeholder="Your message" rows="10"></textarea>
            </div>
        </div>
        <div class="col-md-12 text-center">
            <button type="submit" class="btn btn-template">Send Message</button>
        </div>
    </div>
</form>

contactproces.php

 <?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $formcontent=" From: $name \n  Email: $email \n  Subject: $subject  \n  
    Message: $message";
    $recipient = "admin@...com";
    $subject = "Enquiry Form";
    $mailheader = "From: $email \r\n";
    mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
    echo "Thank you for getting in touch..! We will get back you as soon as we review your message.";
 ?>

这是我的引导程序联系表单代码,它很简单并且可以正常工作,但是当我尝试将其用于wordpress时遇到错误时,我通过更改操作字段尝试了很多操作。任何人都可以告诉我该做些什么真正的修改contactfrm,以便在wordpress中正常工作。请共享解决方案

错误: 我不知道我必须进行哪些可能的更改,以及如何在php中链接这些页面以及将php代码放置在哪里。我尝试在get_header()之前将contactprocess代码放在cotact.php中;并且在动作中我添加了(action =“ php the_permalink();”)。因为它的显示消息位于顶部(感谢您与我们联系。。!我们会在审核您的消息后尽快回覆您。)而无需提交表单。当我尝试提交表单时,它会直接指向同一链接domianname / contact /带有首页内容,而没有内容的邮件

0 个答案:

没有答案