  | 
              
	              
	                
  
    
	 
        จะเปลี่ยนภาษาในไฟล์รับ-ส่งอีเมล์ตรงไหนคะ.........................     | 
   
  
    |   | 
   
 
 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 จะอธิบายอย่างไรดี กด submit ปุ๊บ ข้อมูลส่งมาอีเมลล์ปั๊บ  
ก็ลองไล่ ๆ หาว่า หลังจาก submit มันวิ่งไปที่ไฟล์ไหน ตรง action ครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-02-07 12:04:52 | 
                        By :
                            apisitp | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 1 เขียนโดย : apisitp เมื่อวันที่ 2019-02-07 12:04:52 
รายละเอียดของการตอบ ::
  ... ใส่ความคิดเห็นตรงนี้.......
  
 
Code (PHP) 
<?php
session_start();
include "function.php";
include "dbconfig.php";
include "config.php";
conndb();
function get_send_method_name($send_method_id)
{
    $query = "select * from send_method_tb where id = '$send_method_id'";
    $result= mysql_query($query);
    $row = mysql_fetch_array($result);
    return $row['method_name'];
}
function get_send_method_price($send_method_id)
{
    $query = "select * from send_method_tb where id = '$send_method_id'";
    $result= mysql_query($query);
    $row = mysql_fetch_array($result);
    return $row['method_price'];
}
$send_method_id = $_POST['send_method_id'];
$money_total = $_SESSION['total'] + get_send_method_price($send_method_id);
$fullname = $_POST['fullname'];
$tel = $_POST['tel'];
$email = $_POST['email'];
$address = $_POST['address'];
$remarks = $_POST['remarks'];
$order_datetime = date("Y-m-d H:i:s");
$member_id = $_POST['member_id'];
$insert1 = "insert into orders(order_id,order_status,update_qty_ok,money_total,member_id,fullname,tel,email,address,remarks,order_datetime) VALUES ('','รอการชำระเงิน','N','$money_total','$member_id','$fullname','$tel','$email','$address','$remarks','$order_datetime')";
$result1 = mysql_query($insert1);
$order_id = mysql_insert_id();
foreach ($_SESSION['SHOPPING_CART'] as $itemNumber => $item) {
         $qty = $item['qty'];
         $price = $item['price'];
         $product_name = $item['name'];
         $product_id = $item['product_id'];
         // ทำการเก็บรายการสินค้าที่สั่งซื้อเอาไว้ในตาราง orderdetails โดยใช้ order_id เป็น Foreign Key ในการจับคู่กับใบสั่งซื้อสินค้าในภายหลัง
         $insert2 = "insert into orderdetails(orderdetails_id,order_id,product_id,product_name,qty,price) VALUES ('','$order_id','$product_id','$product_name','$qty','$price')";
         $result2 = mysql_query($insert2);
}
         $send_method_price_tmp = get_send_method_price($send_method_id);
         $send_method_name_tmp = get_send_method_name($send_method_id);
         $insert3 = "insert into orderdetails(orderdetails_id,order_id,product_id,product_name,qty,price) VALUES ('','$order_id',-1,'$send_method_name_tmp','1','$send_method_price_tmp')";
         $result3 = mysql_query($insert3);
// เริ่มต้น Code การส่งเข้าอีเมล์
$mess .= $email_body."
<center><br><hr width=550>
<p><b><font size=5>Product invoice</font></b><br></p>
  <table width=550 border=1 cellpadding=0 cellspacing=0>
      <tr>
        <td colspan=4>
        <center>
<table width=100% cellpadding=0 cellspacing=0>
	<tr>
		<td width=50%> <b><font color=red>Order number : $order_id</font></b></td>
		<td width=50%> <b><font color=red>Order date / time : ".convert_datetime($order_datetime)."</font></b></font></b></td>
	</tr>
</table>
        </center>
        </td>
      </tr>
    
      <tr>
        <td width=235 bgcolor=#FFFFCC>
        <font color=#000080><center>Product Name</center></font></td>
        <td width=120 bgcolor=#FFFFCC>
        <font color=#000080><center>Price/Unit</center></font></td>
        <td width=55 bgcolor=#FFFFCC>
        <font color=#000080><center>Unit</center></font></td>
        <td width=140 bgcolor=#FFFFCC>
        <font color=#000080><center>Total</center></font></td>
      </tr>";
 
        foreach ($_SESSION['SHOPPING_CART'] as $itemNumber => $item) {
        
$mess .= "
        <tr>    
            <td width=235 bgcolor=#CCFFFF> ".$item['name']." </td>
            <td width=120 bgcolor=#CCFFFF><div align=right>".number_format($item['price'],2,'.',',')." </div></td>
            <td width=55 bgcolor=#CCFFFF><div align=right>".number_format($item['qty'],0,'.',',')." </div></td>
            <td width=140 bgcolor=#CCFFFF><div align=right>".number_format($item['qty'] * $item['price'],2,'.',',')." </div></td>        
        </tr>
";
        }
        
$mess .= "
        <tr>    
            <td width=235 bgcolor=#CCFFFF> ".$send_method_name_tmp." </td>
            <td width=120 bgcolor=#CCFFFF><div align=right>".number_format($send_method_price_tmp,2,'.',',')." </div></td>
            <td width=55 bgcolor=#CCFFFF><div align=right>".number_format(1,0,'.',',')." </div></td>
            <td width=140 bgcolor=#CCFFFF><div align=right>".number_format($send_method_price_tmp,2,'.',',')." </div></td>        
        </tr>
";
$mess .= "
        <tr id=itemtotal>    
            <td width=410 bgcolor=#FFFFCC colspan=3 valign=middle><div align=left>
            <b><font color=#008000> Total price</font></b></div></td>
            <td width=140 bgcolor=#FFFFCC valign=middle>
            <div align=right><b><font color=#008000>".number_format($_SESSION['total']+$send_method_price_tmp,2,'.',',')." baht </font></b></div></td>
        </tr>";
if($use_vat == 1)
{
$mess .= "
        <tr id=itemvat>    
            <td width=410 bgcolor=#FFFFCC colspan=3 valign=middle><div align=left>
            <b><font color=#008000> VAT (7%)</font></b></div></td>
            <td width=140 bgcolor=#FFFFCC valign=middle>
            <div align=right><b><font color=#008000>".number_format(0.07*($_SESSION['total']+$send_method_price_tmp),2,'.',',')." baht </font></b></div></td>
        </tr>";
$mess .= "
        <tr id=itemnettotal>    
            <td width=410 bgcolor=#FFFFCC colspan=3 valign=middle><div align=left>
            <b><font color=#008000> VAT included (7%)</font></b></div></td>
            <td width=140 bgcolor=#FFFFCC valign=middle>
            <div align=right><b><font color=#008000>".number_format($_SESSION['total']+$send_method_price_tmp + 0.07*($_SESSION['total']+$send_method_price_tmp),2,'.',',')." baht </font></b></div></td>
        </tr>";
}
$mess .= "
</table> 
<br>
<table width=500 border=0 cellspacing=5 cellpadding=0> 
<tr> 
<td width=30% class=bodytext>Name :</td> 
<td width=70%>$fullname</td> 
</tr> 
<tr> 
<td>Email :</td> 
<td>$email</td> 
</tr>
<tr> 
<td>Phone :</td> 
<td>$tel</td> 
</tr> 
<tr> 
<td valign=top>Adress :</td> 
<td>$address</td> 
</tr>
<tr> 
<td valign=top>Note :</td> 
<td>$remarks</td> 
</tr> 
</table> 
</center>
";
$mess = str_replace("#fullname#",$fullname,$mess);
$mess = str_replace("#web_tracking#",$web_url."/tracking.php",$mess);
$strFromName = $fullname;
$strFromEmail = $email;
$strTo = $admin_email;
$strSubject = "=?tis-620?B?".base64_encode($email_title)."?=";
//echo $mess; // ตัวแปร $mess เก็บข้อมูลที่ได้รับมาในรูปแบบ HTML และพร้อมส่ง
// เริ่มต้นส่วน Header ของอีเมล์ (ไม่ต้องแก้)
$header  = "MIME-Version: 1.0\n";
$header .= "Content-type: text/html; charset=tis-620\n"; // ถ้าเป็น text/plain คือไม่สามารถแสดง html ได้ และขึ้นบรรทัดใหม่ใช้ \n
$header .= "From: $strFromEmail\n";
$header .= "Return-Path: $strFromEmail\n";
$header .= "Reply-To: $strFromEmail\n";
$header .= "To: $strTo\n";
$header .= "Sent: ".date("jS F Y, g:i a")."\n";
$header .= "X-Mailer: PHP/".phpversion()."\n";
$header .= "X-Priority: 1\n";
$header .= "X-MSmail-Priority: High\n";
mail($strTo,$strSubject,$mess, $header);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<title>Your Shopping Cart</title>
<STYLE type=text/css>
  A:link { color: #0000cc; text-decoration:none}
  A:visited {color: #0000cc; text-decoration: none}
  A:hover {color: red; text-decoration: none}
 </STYLE>
<style type="text/css">
<!--
small { font-family: Arial, Helvetica, sans-serif; font-size: 8pt; } 
input, textarea { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; } 
b { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; } 
big { font-family: Arial, Helvetica, sans-serif; font-size: 14pt; } 
strong { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; font-weight : extra-bold; } 
font, td { font-family: Arial, Helvetica, sans-serif; font-size: 11pt; } 
BODY { font-size: 9pt; font-family: Arial, Helvetica, sans-serif; } 
-->
</style>
<script language="javascript">
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
</script>
</head>
<body>
<center>
<div id="shoppingCartDisplay">
    <center><img src="images/shopping_cart_header.gif"></center>
<table border="0" cellpadding="2" cellspacing="0" width="750" style="border-collapse: collapse" bordercolor="#111111">
<tr bgcolor="#FFFFCC" height="40">
<td width="100%"><div align="center"><b>:: Order results ::</b></div>
</td>
</tr>
<tr bgcolor="#fbdbe8">
<td width="100%"><br>
<div align="center"><font color="green"><b>Success !! Your order information has been saved to the database.</b></font>
<br><br><a href="print.php?order_id=<?=$order_id; ?>" onclick="NewWindow(this.href,'print_order','800','500','yes');return false"><img src="images/printer.png" width="60" border="0"><br>Print your order</a>
<br><br>
</div>
</td>
</tr>
</table>
</div>
</center>
</body>
</html>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-02-07 13:05:13 | 
                        By :
                            2015381758558256 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ข้อมูลตาม code มันก็เป็นภาษาอังกฤษแล้วนี้ครับ แล้วยังไงต่อ พี่ก็งงครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-02-08 09:14:36 | 
                        By :
                            apisitp | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เวลารับข้อมูลทางอีเมล์ หัวข้อยังเป็นภาษาไทยอยู่เลยค่ะ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-02-12 14:06:56 | 
                        By :
                            2015381758558256 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 หามาให้ได้ตัวแปรตัวนี้ มันถูกกำหนดจากไหนมา 
$email_body 
 
ปล. แล้วแน่ใจนะว่าแก้ถูกไฟล์ หลายคนตกม้าตาย เพราะแก้ผิดไฟล์ ทำไว้หลายก๊อปปี้เกิน (โดยเฉพาะคนตอบนี่แหล่ะ 5555)                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2019-02-12 15:29:44              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-02-12 15:25:36 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ใช้พวก git หรือ ide ที่มันมี version history (ส่วนใหญ่จะมีอยู่แล้ว) จะได้ไม่ต้องทำหลาย copy. 
คือทำอันหนึ่ง ถ้าไม่พอใจจะเขียนใหม่ก็ comment ใน history ไว้ว่าอันนี้เราทำอย่างนี้ แล้วพอเขียนใหม่ก็ comment ไว้อีก เวลาไม่พอใจจะกลับไปกลับมาก็เอา history มา compare มันก็จะไม่มีปัญหาไฟล์หลาย copy ซ้ำซ้อน จำผิดๆถูกๆ.                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-02-13 10:38:29 | 
                        By :
                            mr.v | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 หลังจากเจอประสบการณ์ อัพผิดไฟล์ ผมก็เลิกใช้ copy 
แต่ใช้ if else ช่วยใน code เลย จะใช้อันไหน ก็เปลี่ยน 0 เป็น 1  
Code (PHP) 
if(0){
  //test 1
}elseif(0){
  //test 2
}else{
  // org
}
 
พอ ได้เป็นที่พอใจก็ลบ อันที่ไม่ใช้ ออก 
 
ส่วน history ยังไม่เคยใช้ ไว้จะลองใช้ดู ขอบคุณครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-02-13 14:09:35 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |