<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <script language="JavaScript"> function onDelete() { if(confirm('Do you want to send mail ?')==true) { return true; } else { return false; } } </script> <form name="frmMain" action="php_mail2.php" method="post" OnSubmit="return onDelete();"> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM customer"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="600" border="1"> <tr> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> <th width="30"> <div align="center">Delete </div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["CustomerID"];?></div></td> <td><?=$objResult["Name"];?></td> <td><?=$objResult["Email"];?></td> <td><div align="center"><?=$objResult["CountryCode"];?></div></td> <td align="right"><?=$objResult["Budget"];?></td> <td align="right"><?=$objResult["Used"];?></td> <td align="center"><input type="checkbox" name="chkSend[]" value="<?=$objResult["Email"];?>"></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?> <input type="submit" name="btnDelete" value="Delete"> </form> </body> </html>
<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); for($i=0;$i<count($_POST["chkSend"]);$i++) { if($_POST["chkSend"][$i] != "") { $strTo = $_POST["chkSend"][$i]; $strSubject = "Test Send Email"; $strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 // $strHeader .= "From: Mr.Weerachai Nukitram<[email protected]>\nReply-To: [email protected]"; $strVar = "My Message"; $strMessage = " <h1>My Message</h1><br> <table width='285' border='1'> <tr> <td><div align='center'><strong>My Message </strong></div></td> <td><div align='center'><font color='red'>My Message</font></div></td> <td><div align='center'><font size='2'>My Message</font></div></td> </tr> <tr> <td><div align='center'>My Message</div></td> <td><div align='center'>My Message</div></td> <td><div align='center'>My Message</div></td> </tr> <tr> <td><div align='center'>".$strVar."</div></td> <td><div align='center'>".$strVar."</div></td> <td><div align='center'>".$strVar."</div></td> </tr> </table>"; @mail($strTo,$strSubject,$strMessage,$strHeader); } } echo "Record Deleted."; mysql_close($objConnect); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง