需要Form的mail.php脚本

时间:2012-02-10 07:05:55

标签: php phpmailer

我有一个表单,但我需要一个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>

在此我需要另一个复选框,它基本上是用户在提交表单之前需要检查的免责声明。提前谢谢。

1 个答案:

答案 0 :(得分:0)

您可以阅读这篇文章。 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);
?>