2013-09-30 56 views
0

我有一個聯繫銷售表單。我想要在我的電子郵件ID中獲取此表單數據,當人員填寫值時,所有數值數據都會以電子郵件中的表格形式顯示給我。我用下面的代碼不按用戶顯示 HTML輸入的值:發送電子郵件中的表格數據

<tr> 
     <td width="298">First Name <span style="color:#FF0000">*</span></td> 
     <td width="37">&nbsp;</td> 
     <td width="297">Last Name <span style="color:#FF0000">* </span></td> 
     </tr> 
     <tr> 
     <td><input type="text" name="fname" class="saleform" /></td> 
     <td>&nbsp;</td> 
     <td><input type="text" name="lname" class="saleform" /></td> 
     </tr> 
     <tr> 
     <td>Company <span style="color:#FF0000">* </span></td> 
     <td rowspan="2">&nbsp;</td> 
     <td>Job Title <span style="color:#FF0000">* </span></td> 
     </tr> 
     <tr> 
     <td><input type="text" name="company" class="saleform" /></td> 
     <td><input type="text" name="job" class="saleform" /></td> 
     </tr> 
     <tr> 
     <td>Phone No <span style="color:#FF0000">* </span></td> 
     <td>&nbsp;</td> 
     <td>Email Id <span style="color:#FF0000">* </span></td> 
     </tr> 
     <tr> 
     <td><input type="text" name="phone" class="saleform" /></td> 
     <td>&nbsp;</td> 
     <td><input type="text" name="email" class="saleform" /></td> 
     </tr> 

     <tr> 
     <td>Comment and Question<span style="color:#FF0000"> *</span></td> 
     <td>&nbsp;</td> 
     <td>&nbsp;</td> 
     </tr> 
     <tr> 
     <td colspan="3"><inp/td> 
      <textarea name="messages" class="saleform" style="width:647px; height:100px;"></textarea></td> 
     </tr> 
     <tr> 
     <td><input type="submit" class="button" value="Submit" align="left" style="margin-right:9px;" /> 
      <input name="button2" type="reset" class="button" style="margin-right:9px;" value="Clear" align="left" /></td> 
     <td>&nbsp;</td> 
     <td width="297">&nbsp;</td> 
     </tr> 
    </table> 

    </form> 

回答

0

請使用以下:)和定製:)

<html> 
<body> 

<?php 
if (isset($_REQUEST['email'])) 
//if "email" is filled out, send email 
    { 
    //send email 
    $email = $_REQUEST['email'] ; 
    $subject = $_REQUEST['subject'] ; 
    $message = $_REQUEST['message'] ; 
    mail("[email protected]", $subject, 
    $message, "From:" . $email); 
    echo "Thank you for using our mail form"; 
    } 
else 
//if "email" is not filled out, display the form 
    { 
    echo "<form method='post' action='mailform.php'> 
    Email: <input name='email' type='text'><br> 
    Subject: <input name='subject' type='text'><br> 
    Message:<br> 
    <textarea name='message' rows='15' cols='40'> 
    </textarea><br> 
    <input type='submit'> 
    </form>"; 
    } 
?> 

</body> 
</html>