Head First PHP 第4章sendemail.php
来源:互联网 发布:手机淘宝不能购买东西 编辑:程序博客网 时间:2024/06/05 17:16
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Make Me Elvis - Send Email</title> <link rel="stylesheet" type="text/css" href="style.css" /></head><body><img src="blankface.jpg" width="161" height="350" alt="" style="float:right" /><img name="elvislogo" src="elvislogo.gif" width="229" height="32" border="0" alt="Make Me Elvis" /><p><strong>Private:</strong> For Elmer's use ONLY<br /> Write and send an email to mailing list members.</p><?phpif(isset($_POST['submit'])) { $from = '88888@qq.com'; $subject = $_POST['subject']; $text = $_POST['elvismail']; $output_form = false; if(empty($subject) && empty($text)) { echo 'You forgot the email subject and body text.<br />'; $output_form = true; } if(empty($subject) && (!empty($text))) { echo 'You forgot the mail subject.<br />'; $output_form = true; } if((!empty($subject)) && empty($text)) { echo 'You forgot the email body text.<br />'; $output_form = true; }} else { $output_form = true;}if(!empty($subject) && !empty($text)) { $dbc = mysqli_connect('localhost:3306', 'root', '', 'elvis_store') or die('Error connecting mysql'); $query = 'SELECT * FROM email_list'; $result = mysqli_query($dbc, $query) or die('Error querying database'); while($row = mysqli_fetch_array($result)) { $to = $row['email']; $first_name = $row['first_name']; $last_name = $row['last_name']; $msg = "Dear $first_name $last_name, \n$text"; mail($to, $subject, $msg, 'From: ' . $from); echo 'Email sent to: ' . $to . '<br />'; } mysqli_close($dbc);}if($output_form) {?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <label for="subject">Subject of email:</label><br/> <input id="subject" name="subject" type="text" value="<?php echo @$subject; ?>" size="30"/><br/> <label for="elvismail">Body of email:</label><br/> <textarea id="elvismail" name="elvismail" rows="8" cols="40"><?php echo @$text; ?></textarea><br/> <input type="submit" name="submit" value="Submit"/> </form><?php}?></body></html>
0 0
- Head First PHP 第4章sendemail.php
- Head First PHP 第4章 addemail.php
- Head First PHP 第4章 removeemail.php
- Head First PHP & MySQL
- head first PHP$MySQL 笔记
- [Head.First.PHP.&.MySQL]pdf
- Head First PHP &MySQL学习笔记
- Head First PHP&MySQL学习笔记(一)
- Head First PHP&MySQL学习笔记(二)
- Head First PHP&MySQL学习笔记(三)
- Head First PHP&MySQL学习笔记(四)
- Head First PHP&MySQL学习笔记(五)
- Head First PHP&MySQL学习笔记(六)
- Head First设计模式PHP版
- Head First Python (中文)学习笔记-第4章
- [设计模式]head first 设计模式之PHP实现 第二章 观察者模式
- [设计模式]head first 设计模式之PHP实现 第三章 装饰者模式
- [设计模式]head first 设计模式之PHP实现 第一章
- android NDK下log的使用和封装2
- 秒杀倒计时JS代码
- CSS实现自适应高度布局:头部底部固定,中间自适应铺满屏幕剩余高度,中间盒子里左盒子固定右盒子自适应宽度
- JSP中文乱码,及编码问题
- OpenGL系列教程之四:OpenGL 变换
- Head First PHP 第4章sendemail.php
- jsonp跨域请求
- bzoj 1008 越狱 快速幂
- appium Demo Java篇
- [Android]AIDL中的in,out,inout理解
- OpenGL系列教程之五:OpenGL矩阵类
- 【NOIP】CODE[VS] 1044 拦截导弹 动态规划 序列型DP
- Mybatis的模糊查询方法
- linux解决xhost: unable to open display ""