模板PHP联系表

时间:2017-01-03 20:56:38

标签: php html wordpress forms contact

嘿伙计们我刚买了一个模板而且客户支持拒绝帮助我,除非我在我已经购买的模板的费用之上付款...发烟。

所以我离开了好的ol'我知道的Stack Overflow朋友会帮我解决这个问题。

所以问题出在联系表格上......

他们没有提供PHP文件,我想知道我的错误是什么......

这是联系表单的代码 - HTML

<div class="wpb_wrapper">
    <div role="form" class="wpcf7" id="wpcf7-f837-p60-o1" lang="en-US" dir="ltr">
        <div class="screen-reader-response"></div>
        <form action="php/contacto.php" method="post" class="wpcf7-form" novalidate="novalidate">
            <p>Your Name (required)
                <br /> <span class="wpcf7-form-control-wrap your-name"><input type="text" name="your-name" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false" id="name" /></span> </p>
            <p>Your Email (required)
                <br /> <span class="wpcf7-form-control-wrap your-email"><input type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" aria-invalid="false" id="email" /></span> </p>
            <p>Subject
                <br /> <span class="wpcf7-form-control-wrap your-subject"><input type="text" name="your-subject" value="" size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false" id="subject" /></span> </p>
            <p>Your Message
                <br /> <span class="wpcf7-form-control-wrap your-message"><textarea name="your-message" cols="40" rows="6" class="wpcf7-form-control wpcf7-textarea" aria-invalid="false" id="message"></textarea></span> </p>
            <p>
                <input type="submit" value="Send" class="wpcf7-form-control wpcf7-submit" />
            </p>
            <div class="wpcf7-response-output wpcf7-display-none"></div>
        </form>
    </div>
</div>

这是我在php文件夹中的php文件...

<?php
session_start();
if( isset($_POST['name']) && strtoupper($_POST['captcha']) == $_SESSION['captcha_id'] )
{
    $to = 'info@mywebsite.com'; // Replace with your email  
    $subject = 'Message from website'; // Replace with your $subject
    $headers = 'From: ' . $_POST['email'] . "\r\n" . 'Reply-To: ' . $_POST['email'];    

    $message = 'Name: ' . $_POST['name'] . "\n" .
               'E-mail: ' . $_POST['email'] . "\n" .
               'Subject: ' . $_POST['subject'] . "\n" .
               'Message: ' . $_POST['message'];

    mail($to, $subject, $message, $headers);    
    if( $_POST['copy'] == 'on' )
    {
        mail($_POST['email'], $subject, $message, $headers);
    }
}
?>

0 个答案:

没有答案