Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ปัญหาเกี่ยวกับภาษาอีกแล้วค่ะ ช่วยหน่อย จนปัญญามากเลยค่ะ



 

ปัญหาเกี่ยวกับภาษาอีกแล้วค่ะ ช่วยหน่อย จนปัญญามากเลยค่ะ

 



Topic : 020180

Guest




เอามาให้แล้วลองวิเคราะห์กันด้วยนะคะ ประมาณว่าจนปัญญาค่ะ อันนี้เป็น code ที่ทำทั้งหมด 3 อย่างค่ะ เมื่อ User กด Submit ข้อมูลจะเก็บใน Database และจะส่งmail หา webmaster ([email protected]) และจะทำการส่ง Mail หา user ด้วยในตัว
และนอกจากภาษาจะเพี้ยนแล้วเมื่อส่ง Mail ยังเข้าเป็น Mail ขยะด้วยค่ะ มีวิธีแก้ไหมคะ


<?

if (isset($_POST['fname'])) {
$fname = $_POST['fname'];
} else {
$fname = "0";
}

if (isset($_POST['email'])) {
$email = $_POST['email'];
} else {
$email = "0";
}

if (isset($_POST['telephone'])) {
$telephone = $_POST['telephone'];
} else {
$telephone = "0";
}

if (isset($_POST['detail'])) {
$detail = $_POST['detail'];
} else {
$detail = "0";
}

if (isset($_POST['chk1'])) {
$contact = $_POST['chk1'];
} else {
$contact = "0";
}

if (isset($_POST['chk2'])) {
$news = $_POST['chk2'];
} else {
$news = "0";
}

include("../include/dbinfo.inc");


mysql_connect ($host, $username, $password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO register
(fname,email,telephone,detail,date,contact,news)
VALUES ('$fname','$email','$telephone','$detail','$date','$contact','$news')";
$result=mysql_query($query);
mysql_close();


$newschk1 = "ต้องการข้อมูลเพิ่มเติมให้ติดต่อกลับ";
$newschk2 = "ต้องการได้รับข่าวสารของผลิตภัณฑ์จากเรา";

if (isset($_POST['chk1'])) {
$news1 = $newschk1 ;
} else {
$newschk1 = "0";
}

if (isset($_POST['chk2'])) {
$news2 = $newschk2;
} else {
$newschk2 = "0";
}

/* recipients */
$to = "[email protected]";
$to2="$email";


/* subject */
$subject = "ยินดีต้อนรับ";
$subject2 = "ยินดีต้อนรับ";

/* message */
$message = "
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'> // เปลี่ยนเป็น windows-874 หรือ tis-620 แล้วก็ยังไม่ได้
<title>Message</title>
</head>
<body>
<p>Note: This email was generated from web</p>
<table>
<tr>
<td>Name : $fname</td>
</tr>
<tr>
<td>Email : $email</td>
</tr>
<tr>
<td>Telephone : $telephone</td>
</tr>
<tr>
<td>Message : $detail</td>
</tr>
<tr>
<td>$news1</td>
</tr>
<tr>
<td$news2</td>
</tr>
</table>
</body>
</html>
";

/* message2 */
$message2 = "
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'> // เปลี่ยนเป็น windows-874 หรือ tis-620 แล้วก็ยังไม่ได้

<title>Thanks you</title>
</head>
<body>
<p>Note: This email was generated from web</p>
<table>
<tr>
<td>สวัสดีค่ะคุณ&nbsp;&nbsp;$fname</td>
</tr>
<tr>
<td>ข้อมูลของท่านคือ</td>
</tr>
<tr>
<td>Name : $fname</td>
</tr>
<tr>
<td>Email : $email</td>
</tr>
<tr>
<td>Telephone : $telephone</td>
</tr>
<tr>
<td>Message : $detail</td>
</tr>
<tr>
<td>$news1</td>
</tr>
<tr>
<td>$news2</td>
</tr>
<tr>
<td>ทางเราหวังเป็นอย่างยิ่งว่าจะได้รับความไว้วางใจจากท่านในการเลือกใช้ผลิตภัณฑ์ของ </td>
</tr>
<tr>
<td>ขอบคุณค่ะ</td>
</tr>
</table>
</body>
</html>
";

/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=windows-874\r\n";
$headers2 = "MIME-Version: 1.0\r\n";
$headers2 .= "Content-type: text/html; charset=windows-874\r\n";


/* additional headers */
//$headers .= "To: $to\r\n";
$headers .= "From: $fname <$email>\r\n";
$headers2.= "From: nahm-sanitaryware.com";

/* and now mail it */
mail($to, $subject, $message, $headers);
mail($to2,$subject2, $message2, $headers2);
?>


$headers .= "Content-type: text/html; charset=windows-874\r\n"; /
$headers2 .= "Content-type: text/html; charset=windows-874\r\n";
ถ้าใช้เป็น windows-874 ตัวที่เป็น $fname หรืออื่น ๆ ที่รับค่ามา จะเป็นภาษาไทย แต่ ที่รับค่าของ $message และ $message2 จะเป็นเพี้ยน ถ้าเปลี่ยนเป็น utf-8 ตัวที่รับค่า $fname หรืออื่น ๆ จะเป็นภาษาเพี้ยน แต่ $message และ $message2 จะเป็นไทย




Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 27 พ.ค. 2551 15:00:15 By : จนปัญญา View : 1455 Reply : 0
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ปัญหาเกี่ยวกับภาษาอีกแล้วค่ะ ช่วยหน่อย จนปัญญามากเลยค่ะ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่