PHP联系表单不支持HTML代码

时间:2015-05-21 18:13:28

标签: php html css

我对这个PHP有点困惑有人可以告诉我为什么它不能使用我的HTML表单?我已将其上传到我的域名并尝试过但仍然没有运气。我比PHP类型更像是一个javaScript,HTML,CSS前端设计师....虽然我确实需要学习!任何帮助,将不胜感激。

PHP代码

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$from = 'From: website'; 
$to = 'email goes here'; 
$subject = 'Email Inquiry';

$body = "From: {$name}\n E-Mail: {$email}\n Message:\n {$message}";


if ($_POST['submit']) {
    if (mail ($to, $subject, $body, $from)) { 
        echo '<p>Thank you for your email! You will now be redirected to the Home Page.</p>';
    } else { 
        echo '<p>Oops! An error occurred. Try sending your message again.</p>'; 
    }
}
?>

HTML CODE

<form action="form.php" method="post" enctype="multipart/form-data">

            <label></label>
            <input name="name" required placeholder="Your Name">


            <label></label>
            <input name="email" type="email" required placeholder="Your Email">

            <label></label>
            <input name="tel" type="tel"  placeholder="Your Contact Number">

            <label></label>
            <select name="treatment">
            <option value="">Select...</option>
            <option value="anti-wrinkle">Anti-Wrinkle Injections</option>
            <option value="dermal-fillers">Dermal Fillers</option>
            <option value="vampire-facelift">The Vampire Facelift</option>
            <option value="other-treatments">Other Treatments</option>
            </select> 


            <label></label>
            <textarea name="message" cols="20" rows="5" required placeholder="Message"></textarea>

            <input id="submit" name="submit" type="submit" value="Submit">

        </form>

0 个答案:

没有答案