Tue 14 Feb 2006 20:25:34
อัพโหลดแล้วแต่ยังส่งเมล์ไม่ได้
<form action="add_contact.php" method="post" enctype="multipart/form-data" name="frmcontact" id="frmcontact">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="28%" height="36" class="articlescolor" scope="col"><div align="right">ชื่อผู้ส่งข้อความ</div></td>
<th width="1%" scope="col"> </th>
<td colspan="2" scope="col"><input name="name" type="text" id="name" size="40"></td>
</tr>
<tr>
<td height="36" class="articlescolor"><div align="right">อีเมล์ผู้ส่ง</div></td>
<td> </td>
<td colspan="2"><input name="email" type="text" id="email" size="40"></td>
</tr>
<tr>
<td height="36"><div align="right" class="articlescolor">หัวเรื่อง</div></td>
<td> </td>
<td colspan="2"><input name="title" type="text" id="title" size="40"></td>
</tr>
<tr>
<td ><div align="right" class="articlescolor">ข้อความรายละเอียด</div></td>
<td><div align="center" class="articlescolor">:</div></td>
</tr>
<tr>
<td height="138"> </td>
<td> </td>
<td colspan="2"><textarea name="detail" cols="40" rows="7" wrap="VIRTUAL" id="detail"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="17%"><div align="center">
<input type="submit" name="Submit" value="ส่งข้อความ">
</div></td>
<td width="54%"><input type="reset" name="Submit2" value="ลบข้อความ"></td>
</tr>
</table>
</form>
แล้ว ไฟล์ add_contact.php เขียนโค้ดยังไง
//add_contact.php
if(isset($_POST["name"]) && isset($_POST["email"]) &&
isset($_POST["title"]) && isset($_POST["detail"])){
//ตรวจสอบว่ามีการส่งค่ามาในตัวแปรทั้งหมด
$header = "MIME-Version: 1.0\r\n"; //ระบุว่าเป็นเอกสารตามมาตรฐาน MIME 1.0
(Optional)
$header .= Content-type: text/html; charset-tis-620\r\n";
//ระบุเพื่อให้สามารถแสดงผลข้อความในรูปแบบ html ได้ (Optional)
$header .= "FROM: ".$_POST["name"]." <".$POST["email"].">\r\n";
//ระบุว่าใครเป็นผู้ส่ง (Optional)
if(mail("someone@somewhere.com",$_POST["title"], $_POST["detail"],
$header)){
die("ส่งเรียบร้อย");
}else{
die("ไม่สามารถส่งได้");
}
}
?>
Wed 15 Feb 2006 17:18:33
ขอบคุณครับ
ตอนแรกมัน error ตรง header ผมเลยเอา header ออก
แต่ก็ขึ้นว่า
Warning: mail() has been disabled for security reasons in /home/hosting/cotseng_mang/public_html/add_contact.php on line 10
ไม่สามารถส่งได้
ตาม Error นี้แจ้งว่าไม่สามารถใช้ Function mail() ได้ครับ คงต้องรบกวนให้ติดต่อผู้ดูแลระบบของเครื่องที่ใช้งานอยู่ครับ
Mon 20 Feb 2006 10:24:10
thang you very much
Today 15:20:15

Tue 14 Feb 2006 20:25:34
เธญเธฑเธเนเธซเธฅเธ”เนเธฅเนเธงเนเธ•เนเธขเธฑเธเธชเนเธเน€เธกเธฅเนเนเธกเนเนเธ”เน
<form action="add_contact.php" method="post" enctype="multipart/form-data" name="frmcontact" id="frmcontact">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="28%" height="36" class="articlescolor" scope="col"><div align="right">เธเธทเนเธญเธเธนเนเธชเนเธเธเนเธญเธเธงเธฒเธก</div></td>
<th width="1%" scope="col"> </th>
<td colspan="2" scope="col"><input name="name" type="text" id="name" size="40"></td>
</tr>
<tr>
<td height="36" class="articlescolor"><div align="right">เธญเธตเน€เธกเธฅเนเธเธนเนเธชเนเธ</div></td>
<td> </td>
<td colspan="2"><input name="email" type="text" id="email" size="40"></td>
</tr>
<tr>
<td height="36"><div align="right" class="articlescolor">เธซเธฑเธงเน€เธฃเธทเนเธญเธ</div></td>
<td> </td>
<td colspan="2"><input name="title" type="text" id="title" size="40"></td>
</tr>
<tr>
<td ><div align="right" class="articlescolor">เธเนเธญเธเธงเธฒเธกเธฃเธฒเธขเธฅเธฐเน€เธญเธตเธขเธ”</div></td>
<td><div align="center" class="articlescolor">:</div></td>
</tr>
<tr>
<td height="138"> </td>
<td> </td>
<td colspan="2"><textarea name="detail" cols="40" rows="7" wrap="VIRTUAL" id="detail"></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="17%"><div align="center">
<input type="submit" name="Submit" value="เธชเนเธเธเนเธญเธเธงเธฒเธก">
</div></td>
<td width="54%"><input type="reset" name="Submit2" value="เธฅเธเธเนเธญเธเธงเธฒเธก"></td>
</tr>
</table>
</form>
เนเธฅเนเธง เนเธเธฅเน add_contact.php เน€เธเธตเธขเธเนเธเนเธ”เธขเธฑเธเนเธ
//add_contact.php
if(isset($_POST["name"]) && isset($_POST["email"]) &&
isset($_POST["title"]) && isset($_POST["detail"])){
//เธ•เธฃเธงเธเธชเธญเธเธงเนเธฒเธกเธตเธเธฒเธฃเธชเนเธเธเนเธฒเธกเธฒเนเธเธ•เธฑเธงเนเธเธฃเธ—เธฑเนเธเธซเธกเธ”
$header = "MIME-Version: 1.0\r\n"; //เธฃเธฐเธเธธเธงเนเธฒเน€เธเนเธเน€เธญเธเธชเธฒเธฃเธ•เธฒเธกเธกเธฒเธ•เธฃเธเธฒเธ MIME 1.0
(Optional)
$header .= Content-type: text/html; charset-tis-620\r\n";
//เธฃเธฐเธเธธเน€เธเธทเนเธญเนเธซเนเธชเธฒเธกเธฒเธฃเธ–เนเธชเธ”เธเธเธฅเธเนเธญเธเธงเธฒเธกเนเธเธฃเธนเธเนเธเธ html เนเธ”เน (Optional)
$header .= "FROM: ".$_POST["name"]." <".$POST["email"].">\r\n";
//เธฃเธฐเธเธธเธงเนเธฒเนเธเธฃเน€เธเนเธเธเธนเนเธชเนเธ (Optional)
if(mail("someone@somewhere.com",$_POST["title"], $_POST["detail"],
$header)){
die("เธชเนเธเน€เธฃเธตเธขเธเธฃเนเธญเธข");
}else{
die("เนเธกเนเธชเธฒเธกเธฒเธฃเธ–เธชเนเธเนเธ”เน");
}
}
?>
Wed 15 Feb 2006 17:18:33
เธเธญเธเธเธธเธ“เธเธฃเธฑเธ
เธ•เธญเธเนเธฃเธเธกเธฑเธ error เธ•เธฃเธ header เธเธกเน€เธฅเธขเน€เธญเธฒ header เธญเธญเธ
เนเธ•เนเธเนเธเธถเนเธเธงเนเธฒ
Warning: mail() has been disabled for security reasons in /home/hosting/cotseng_mang/public_html/add_contact.php on line 10
เนเธกเนเธชเธฒเธกเธฒเธฃเธ–เธชเนเธเนเธ”เน
เธ•เธฒเธก Error เธเธตเนเนเธเนเธเธงเนเธฒเนเธกเนเธชเธฒเธกเธฒเธฃเธ–เนเธเน Function mail() เนเธ”เนเธเธฃเธฑเธ เธเธเธ•เนเธญเธเธฃเธเธเธงเธเนเธซเนเธ•เธดเธ”เธ•เนเธญเธเธนเนเธ”เธนเนเธฅเธฃเธฐเธเธเธเธญเธเน€เธเธฃเธทเนเธญเธเธ—เธตเนเนเธเนเธเธฒเธเธญเธขเธนเนเธเธฃเธฑเธ
Mon 20 Feb 2006 10:24:10
thang you very much
















