php联系表单无法正常工作

时间:2018-05-15 16:18:42

标签: php html email phpmailer contact

我正在尝试使用Materialise css将简单的联系我表单设置到我的网页。但不幸的是它没有用。我尝试了很多次,但没有运气。我对此表示感谢。

这是我的HTML表单

<form action="process.php" method="POST" class="col s12 m12 l12 xl12" style=" text-shadow: 5px 5px 10px black;">
    <div class="row">
         <div class="col s12 m12 l12 xl12">
              <div class="input-field col s12 m6 l6 xl6">
                   <i class="material-icons prefix">account_circle</i>
                   <input id="name" name="name" type="text" class="validate">
                   <label for="name">Name</label>
                   </div>
                   <div class="input-field col s12 m6 l6 xl6">
                        <i class="material-icons prefix">phone</i>
                        <input id="mobile" name="mobile" type="tel" class="validate">
                        <label for="mobile">Mobile No</label>
                   </div>
                </div>
              </div>
              <div class="row">
                <div class="col s12 m12 l12 xl12">
                    <div class="input-field col s12 m12 l12 xl12">
                        <i class="material-icons prefix">email</i>
                        <input id="email" name="email" type="email" class="validate">
                        <label for="email">Email</label>
                        <span class="helper-text" data-error="wrong" data-success="right"></span>
                    </div>
                </div>
              </div>
              <div class="row">
                <div class="col s12 m12 l12 xl12">
                    <div class="input-field col s12 m1 l12 xl12">
                        <i class="material-icons prefix">message</i>
                        <textarea id="message" name="message" class="materialize-textarea" data-length="150"></textarea>
                        <label for="message">Message</label>
                    </div>
                </div>
              </div>
              <div style="text-align: right;">
                <input class="btn waves-effect indigo darken-4" type="submit" name="messageMe" value="Send">
              </div>
            </form>

这是process.php文件

<?php

    $myemail  = "myemail@gmail.com";

    $name = $_POST['name'];
    $mobile = $_POST['mobile'];
    $email = $_POST['email'];
    $message = $_POST['message'];

    if (mail($myemail, $name, $mobile, $message, $email)) {
        echo "Message sent!";
    }else{
        echo "Message not sent!";
    }
?>

0 个答案:

没有答案