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,038

HOME > PHP > PHP Forum > เขียนสคริปส่งเมล์แต่ไม่สามารถแสดงค่าที่อยู่ในตัวแปรที่ส่งไปใครรู้บ้างครับพี่น้องครับสงเคราะห์ผมที


[PHP] เขียนสคริปส่งเมล์แต่ไม่สามารถแสดงค่าที่อยู่ในตัวแปรที่ส่งไปใครรู้บ้างครับพี่น้องครับสงเคราะห์ผมที

 
Topic : 045181



โพสกระทู้ ( 0 )
บทความ ( 0 )



สถานะออฟไลน์



ผมเขียนระบบช๊อปปิ้งชาตติดตรงที่เวลาลูกค้าสั่งซื้อแล้วระบบผมจะต้องส่งเมล์บอกว่าลูกค้าเค้าสั่งซื้ออะไรบ้าง จำนวนกี่ชิ้น ราคารวมเท่าไหร่ ไปยังอีเมล์เค้า ทีนี้ผมเขียนระบบส่งเมล์ได้แล้วแต่ติดตรงที่ไม่สามารถแสดงจำนวนสินค้า หรือว่าราคา ที่กำหนดโดยตัวแปร php ได้ส่งเมล์ไปมันไม่โชวร์ข้อมูลที่เป็นตัวแปรเลยอะครับ ใครพอจะแนะนำได้บ้างครับช่วยทีครับหรือใครมีวิธีอื่นบ้าเค้าทำกันแบบที่ผมทำรึเปล่าช่วยบอกทีผมก็พึ่งเขียนครั้งแรก

ขอบคุณครับ



Tag : - - - -

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-07-08 22:33:54 By : chittipong View : 1172 Reply : 3
 

 

No. 1



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


มันก็เหมือนเขียนหน้าเว็บธรรมดานี่แหละครับ เชื่อมสตริงให้ถูกต้อง แล้วแน่ใจหรอว่าตัวแปรมีค่า

เอาโค๊ดที่เขียนมาแปะ เดี๋ยวมีคนมาช่วยเยอะแยะ
Date : 2010-07-09 01:54:37 By : plakrim
 

 

No. 2

Guest


ประมาณนี้ครับพี่ คือมันจะรับค่า session มาจากหน้า order อีกทีครับพอรันมันได้ทุกอย่างยกเว้นโชว์ค่าตัวแปรออกมา

Code (PHP)
001.<?php
002.session_start();
003.?>
004. 
005.<?php include("include/convertmoney_inc.php"); ?>
006.<?   include"Connections/connect.php"; ?>
007.<?php
008.// multiple recipients
009.$to  = 'jittipong_m@hotmail.com' . ', '; // note the comma
010.$to .= 'jittipong.m@gmail.com';
011. 
012.// subject
013.$subject = 'ท่านได้สั่งซื้อสินค้าจาก SPEEDACCOUNT.COM';
014.$subject = "=?UTF-8?B?".base64_encode($subject)."?="; //convert subject to thai lang
015.// message
016.$message = '
017.<html>
018.<head>
019.  <title>หนังสือบัญชี,คู่มือเตรียมสอบ,เตรียมสอบบัญชี,เตรียมสอบta,เตรียมสอบcpa,คู่มือเตรียมสอบTA,คู่มือสอบเข้าราชการ,คู่มือเตรียมสอบCPA,ชีทเตรียมสอบ,DVDวิชาบัญชี,DVDสอบTA,Speedaccount.com</title>
020.</head>
021.<body>
022.  <p><font color="blue"><strong>คุณได้สั่งซื้อของจากทาง Speedaccount.com มีรายละเอียดดังนี้</strong></font></p>
023.  <table border="1" width="600" cellspacing="0" cellpadding="0">
024.    <tr>
025.      <th  colspan="5" align="left" bgcolor="#0066FF"><font color="#FFFFFF">เลขที่ใบสั่งซื้อ: 00111</font></th>
026.    </tr>
027.    <tr>
028.                  <th bgcolor="#D3EBE8">รหัสสินค้า</th>
029.                  <th bgcolor="#D3EBE8">ชื้อสินค้า</th>
030.                  <th bgcolor="#D3EBE8">ราคาต่อหน่วย</th>
031.                  <th bgcolor="#D3EBE8">จำนวนสั่งซื้อ</th>
032.                  <th bgcolor="#D3EBE8">รวม</th>
033.    </tr>
034.     <?
035.                  
036.                function idpro($a){// function tor find idproduct in database
037.                include"Connections/connect.php";
038.                $sql="select * from product where id=$a ";
039.                $result=mysql_db_query($dbname,$sql);
040.                $data=mysql_fetch_array($result);
041.                $idproduct=$data[idproduct];
042.                return $idproduct;
043.                    }
044.                                          
045.                                              for ($i=0;$i<count ($sess_id) ; $i++){
046.                                            $idproduct=$data[idproduct];
047.                                              $total_unit=$sess_num[$i] * $sess_price [$i];
048.                                              $total=$total+$total_unit;
049.                                              $code=sprintf("%05d",$sess_id[$i]);  
050.                                              $idproduct=idpro($sess_id[$i]);
051. 
052.            ?>
053.<tr>
054.              <td><? echo $idproduct ?></td>
055.             <td><div align="center"><? echo $sess_name [$i]?></div></td>
056.              <td><div align="right"><? echo $sess_num[$i]?></div></td>
057.              <td><div align="right"><? echo $sess_price[$i] ?></div></td>
058.             <td><div align="right"><? echo  $total_unit ?></div></td>
059.  </tr>
060.<?
061.            }
062.?>
063. 
064. <tr align="center">
065.              <td colspan="4">ค่าจัดส่ง</td>
066.             <td><? $a=50; echo $a; ?></td>
067. </tr>
068. <tr align="center">
069.              <td colspan="4">ราคารวมทั้งหมด&nbsp;&nbsp;</td>
070.             <td bgcolor="#FFFF99" ><font color="red"><strong><? echo "$total"; ?></strong></font>&nbsp;฿</td>
071. </tr>
072.</table><br/>
073. <font color="blue"> <strong>กรุณาชำระค้าสินค้าโดยการโอนเงินตามหมายเลขบัญชีดังนี้</strong></font><br/><br/>
074.<img src="http://www.speedaccount.com/images/bank-kasikorn.gif" width="36" height="36" align="absmiddle" />&nbsp;ธ.กสิกรไทย  สาขาทองหล่อ ออมทรัพย์ ชื่อบัญชี นายจิตติพงษ์ โม่งประณิตร์ หมายเลข 000000000000<br/>
075. 
076.<img src="http://www.speedaccount.com/images/bank-scb.gif" width="36" height="36" align="absmiddle"/>&nbsp;ธ.ไทยพาณิชย์ สาขาหัวหมาก ออมทรัพย์ ชื่อบัญชี นายจิตติพงษ์ โม่งประณิตร์ หมายเลข 000000000000
077. 
078.<br/><br/>
079.   
080.  ******************หากท่านชำระสินค้าแล้วกรุณาทำการยืนยันตามลิงค์นี้ <a href="http://www.google.co.th/">ยืนยันการชำระเงิน</a>******************<br/>
081.  <font color="red"><strong>หากมีปัญหาในการชำระเงินหรือการยืนยันการชำระเงินติดต่อได้ที่
082.  <br/></strong></font>Tel:089-673-2136
083.  <br/>E-mail: <a href="mailto:webmaster@speedaccount.com">webmaster@speedaccount.com</a><br/><br/><br/>
084.  <p align="center"><font color="red"><strong>ทางเราจะจัดส่งสินค้าให้ทันทีที่ตรวจสอบข้อมูลเรียบร้อย</strong></font></p>
085.  <br/> <font color="blue"> <strong> ขอบคุณที่ใช้บริการ</strong></font><br/>
086. <strong> <a href="www.Speedaccount.com">www.Speedaccount.com</a> </strong><br/>
087. <a href="http://www.speedaccount.com"><img src="http://www.speedaccount.com/images/picformailorder.jpg" width="856" height="139" /></a>
088. <hr>
089. 
090.<p align="center"><strong> จำหน่าย </strong><br/>
091. หนังสือบัญชี,คู่มือเตรียมสอบ,เตรียมสอบบัญชี,เตรียมสอบta,เตรียมสอบcpa,คู่มือเตรียมสอบTA,<br/>คู่มือสอบเข้าราชการ,คู่มือเตรียมสอบCPA,ชีทเตรียมสอบ,DVDวิชาบัญชี,DVDสอบTA
092. </p>
093.  
094.</body>
095.</html>
096.';
097. 
098.// To send HTML mail, the Content-type header must be set
099.$headers  = 'MIME-Version: 1.0' . "\r\n";
100.//$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
101.$headers.= 'Content-type: text/html; charset=UTF-8' . "\r\n";
102.// Additional headers
103.//$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
104.$headers .= 'From: Speedaccount.com <Webmaster@speedaccount.com>' . "\r\n";
105.//$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
106.//$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
107. 
108.// Mail it
109.if(mail($to, $subject, $message, $headers)){
110.    echo "Sendmail Complease<br/>";
111.    echo "<a href='index.php'>home</a>";
112.}else{
113.    echo "Cannot Send mail</br>";
114.    echo "<a href='index.php'>home</a>";
115.}
116.?>

Date : 2010-07-09 17:13:15 By : chittipong
 

 

No. 3



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์



แทนที่ตั้งแต่ $message เลยนะ

Code (PHP)
01.$message = '
02.<html>
03.<head>
04.<title>หนังสือบัญชี,คู่มือเตรียมสอบ,เตรียมสอบบัญชี,เตรียม สอบta,เตรียมสอบcpa,คู่มือเตรียมสอบTA,คู่มือสอบเข้าราชการ,คู่มือเตรียม สอบCPA,ชีทเตรียมสอบ,DVDวิชาบัญชี,DVDสอบTA,Speedaccount.com</title>
05.</head>
06.<body>
07.<p><font color="blue"><strong>คุณได้สั่งซื้อของจากทาง Speedaccount.com มีรายละเอียดดังนี้</strong></font></p>
08.<table border="1" width="600" cellspacing="0" cellpadding="0">
09.<tr>
10.<th colspan="5" align="left" bgcolor="#0066FF"><font color="#FFFFFF">เลขที่ใบสั่งซื้อ: 00111</font></th>
11.</tr>
12.<tr>
13.<th bgcolor="#D3EBE8">รหัสสินค้า</th>
14.<th bgcolor="#D3EBE8">ชื้อสินค้า</th>
15.<th bgcolor="#D3EBE8">ราคาต่อหน่วย</th>
16.<th bgcolor="#D3EBE8">จำนวนสั่งซื้อ</th>
17.<th bgcolor="#D3EBE8">รวม</th>
18.</tr>';
19. 
20.function idpro($a){// function tor find idproduct in database
21.include"Connections/connect.php";
22.$sql="select * from product where id=$a ";
23.$result=mysql_db_query($dbname,$sql);
24.$data=mysql_fetch_array($result);
25.$idproduct=$data[idproduct];
26.return $idproduct;
27.}
28. 
29.for ($i=0;$i<count ($sess_id) ; $i++){
30.$idproduct=$data[idproduct];
31.$total_unit=$sess_num[$i] * $sess_price [$i];
32.$total=$total+$total_unit;
33.$code=sprintf("%05d",$sess_id[$i]);
34.$idproduct=idpro($sess_id[$i]);
35. 
36.$message .= '<tr>
37.<td>' . $idproduct  . '</td>
38.<td><div align="center">' . $sess_name [$i] . '</div></td>
39.<td><div align="right">' . $sess_num[$i] . '</div></td>
40.<td><div align="right">' . $sess_price[$i]  . '</div></td>
41.<td><div align="right">' . $total_unit  . '</div></td>
42.</tr>';
43.}
44.$a=50;
45.$message .= '<tr align="center">
46.<td colspan="4">ค่าจัดส่ง</td>
47.<td>' . $a . '</td>
48.</tr>
49.<tr align="center">
50.<td colspan="4">ราคารวมทั้งหมด&nbsp;&nbsp;</td>
51.<td bgcolor="#FFFF99" ><font color="red"><strong>' . $total . '</strong></font>&nbsp;฿</td>
52.</tr>
53.</table><br/>
54.<font color="blue"> <strong>กรุณาชำระค้าสินค้าโดยการโอนเงินตามหมายเลขบัญชีดัง นี้</strong></font><br/><br/>
55.<img src="http://www.speedaccount.com/images/bank-kasikorn.gif" width="36" height="36" align="absmiddle" />&nbsp;ธ.กสิกรไทย สาขาทองหล่อ ออมทรัพย์ ชื่อบัญชี นายจิตติพงษ์ โม่งประณิตร์ หมายเลข 000000000000<br/>
56. 
57.<img src="http://www.speedaccount.com/images/bank-scb.gif" width="36" height="36" align="absmiddle"/>&nbsp;ธ.ไทยพาณิชย์ สาขาหัวหมาก ออมทรัพย์ ชื่อบัญชี นายจิตติพงษ์ โม่งประณิตร์ หมายเลข 000000000000
58. 
59.<br/><br/>
60. 
61.******************หากท่านชำระสินค้าแล้วกรุณาทำการยืนยันตามลิงค์นี้ <a href="http://www.google.co.th/">ยืนยันการชำระเงิน</a& gt;******************<br/>
62.<font color="red"><strong>หากมีปัญหาในการชำระเงินหรือการยืนยันการชำระ เงินติดต่อได้ที่
63.<br/></strong></font>Tel:089-673-2136
64.<br/>E-mail: <a href="mailto:webmaster@speedaccount.com">webmaster@speedaccount.com</a><br/><br/><br/>
65.<p align="center"><font color="red"><strong>ทางเราจะจัดส่งสินค้าให้ทันทีที่ตรวจสอบ ข้อมูลเรียบร้อย</strong></font></p>
66.<br/> <font color="blue"> <strong> ขอบคุณที่ใช้บริการ</strong></font><br/>
67.<strong> <a href="www.Speedaccount.com">www.Speedaccount.com</a> </strong><br/>
68.<a href="http://www.speedaccount.com"><img src="http://www.speedaccount.com/images/picformailorder.jpg" width="856" height="139" /></a>
69.<hr>
70. 
71.<p align="center"><strong> จำหน่าย </strong><br/>
72.หนังสือบัญชี,คู่มือเตรียมสอบ,เตรียมสอบบัญชี,เตรียมสอบta,เตรียมสอบcpa,คู่ มือเตรียมสอบTA,<br/>คู่มือสอบเข้าราชการ,คู่มือเตรียมสอบCPA,ชีท เตรียมสอบ,DVDวิชาบัญชี,DVDสอบTA
73.</p>
74. 
75.</body>
76.</html>
77.';

Date : 2010-07-09 21:26:34 By : plakrim
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
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 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





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