表单需要一个mail.php脚本


Need a mail.php script for Form

我有一个表单,但我需要一个mail.php,但我不是php专家,有人可以帮助我吗?这是我的表单代码

<form id="form1" id="form1" action="mail.php" method="POST">
    <label>Name
        <span class="small">Add your name</span>
    </label>
<input type="text" name="name">
    <label>Email
        <span class="small">Enter a Valid Email</span>
    </label>
<input type="text" name="email">
    <label>Phone
        <span class="small">Add a Phone Number</span>
    </label>
<input type="text" name="phone">
<label>DOB
        <span class="small">Date Of Birth</span>
    </label>
<input type="text" name="dob">
<br />
<br />
    <label>Salary
        <span class="small">Your annual Salary</span>
    </label>
 <input type="text" name="salary">
    <label>Loan Amount
        <span class="small">Loan</span>
    </label>
 <input type="text" name="loan">
     <label>Property Value
        <span class="small">value of property</span>
    </label>
 <input type="text" name="property">
    <label>City  
        <span class="small">City  </span>
    </label>
<input type="text" name="city">
<br />
<br />
<br />
    <label>Occupation
        <span class="small">Occupation</span>
    </label>
<select name="type" size="1">
<option value="update">Salaried</option>
<option value="change">Self Employment</option>
</select>
<br />
<br />
<br />

    <label>Message
        <span class="small">Type Your Message</span>
    </label>
<textarea name="message" rows="6" cols="25"></textarea><br />
    <button type="submit" value="Send" style="margin-top:15px;">Submit</button>
<div class="spacer"></div>
</form>

在这篇文章中,我最后需要另一个复选框,这基本上是一个免责声明,用户需要在提交表格之前进行检查。提前感谢。

您可以阅读这篇文章。http://www.w3schools.com/php/php_mail.asp它解释了你应该如何做到这一点。一个简单的邮件功能可以写如下。

<?php
$to      = 'name@domain.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: yourname@domain.com' . "'r'n" .
    'Reply-To: yourname@example.com' . "'r'n" .
    'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>