我有錯誤拋出了我的聯繫表單。我不是太熟悉的PHP,所以這裏是我用於PHP和HTML的代碼。聯繫表格省略字段並踢出錯誤
的HTML:
<form name="contactform" method="post" action="sendmail.php" align="center">
<table width="450px" id="black2" style="background-color:#fff" align="center">
</tr>
<tr>
<td valign="top" id="black2"style="background-color:#fff">
<label for="first_name" >First Name *</label>
</td>
<td valign="top"id="black2">
<input type="text" name="first_name" maxlength="50" size="30" id="black2">
</td>
</tr>
<tr>
<td valign="top"" id="black2">
<label for="last_name" id="black2">Last Name *</label>
</td>
<td valign="top">
<input type="text" name="last_name" maxlength="50" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="email">Email Address *</label>
</td>
<td valign="top">
<input type="text" name="email" maxlength="80" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="telephone">Telephone Number</label>
</td>
<td valign="top">
<input type="text" name="telephone" maxlength="30" size="30">
</td>
</tr>
<tr>
<td valign="top">
<label for="comments">Comments *</label>
</td>
<td valign="top">
<textarea name="comments" maxlength="1000" cols="24" rows="6"></textarea>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center">
<input type="submit" value="Submit">
</td>
</tr>
</table>
這裏是PHP:
<?php
$first_name = $_REQUEST['email'];
$last_name = $_REQUEST['last_name'];
$email = $_REQUEST['email'];
$telephone = $_REQUEST['telephone'];
$comments = $_REQUEST['comments'];
mail("[email protected]","Feedback Form Results", $comments, $telephone, $first_name,
$last_name, "From: $email");
header("Location: http://www.mywebsite.co.za/thankyou.html");
?>
請你能幫助我儘快解決這個問題,因爲我跑的AdWords和人民正在設法聯繫。
說出來的形式的錯誤是: 「 Warning: mail() expects at most 5 parameters, 7 given in /home/wwwzeetu/public_html/sendmail.php on line 13
Warning: Cannot modify header information - headers already sent by (output started at /home/wwwzeetu/public_html/sendmail.php:13) in /home/wwwzeetu/public_html/sendmail.php on line 14
」
我感謝您的幫助!
把ob_start();在你的代碼的第一行和[PHP郵件函數](http://www.w3schools.com/php/php_mail.asp)只接受5個參數,但我已經給出了7! 在主體參數中放置'$ telephone,$ first_name,$ last_name'。 – 6339 2013-05-02 08:30:15