当前位置: 编程技术>php
本页文章导读:
▪php实例:响应checkbox复选框中的值 php代码实现的一个复选框操作的例子。
代码:
<html>
<head>
<title>Checkbox复选框演示示例--www.</title>
</head>
<body>
<h1>Checkbox复选框的Demo</h1>
<h3>演示.........
▪php实例:构建基于表单输入的查询字符串 分享一个php实例,构造基于表单的一个查询字符串。
代码:
<?php
/**
* 根据选择的表单,构造 查询字符串
* by www.
*/
if (isset($_POST['submit'])) {
$rowID = $_POST['id'];
mysql_connect("192.168.........
▪php实例:CC(抄送)和BCC(密送)发送电子邮件 php实现的抄送与密送电子邮件的代码,如下:
<HTML>
<HEAD>
<TITLE>发送邮件 with CC and BCC-www.</TITLE>
</HEAD>
<BODY>
<FORM action="/blog_article/sendemailWithCC_BCC.html" method=post name=f.........
[1]php实例:响应checkbox复选框中的值
来源: 互联网 发布时间: 2013-12-24
php代码实现的一个复选框操作的例子。
代码:
<html> <head> <title>Checkbox复选框演示示例--www.</title> </head> <body> <h1>Checkbox复选框的Demo</h1> <h3>演示复选框</h3> <form action ="HandleFormCheckBox.php"> <ul> <li><input type ="checkbox" name ="chkFries" value ="11.00">Fries</li> <li><input type ="checkbox" name ="chkSoda" value ="12.85">Soda</li> <li><input type ="checkbox" name ="chkShake" value ="1.30">Shake</li> <li><input type ="checkbox" name ="chkKetchup" value =".05">Ketchup</li> </ul> <input type ="submit"> </form> </body> </html> <!-- HandleFormCheckBox.php <html> <head> <title>Checkbox Demo</title> </head> <body> <h3>演示阅读复选框</h3> <? print <<<HERE chkFries: $chkFries <br> chkSoda: $chkSoda <br> chkShake: $chkShake <br> chkKetchup: $chkKetchup <br> <hr> HERE; $total = 0; if (!empty($chkFries)){ print ("你选择了 Fires <br>"); $total = $total + $chkFries; } if (!empty($chkSoda)){ print (你选择了 Soda" <br>"); $total = $total + $chkSoda; } if (!empty($chkShake)){ print ("你选择了 Shake <br>"); $total = $total + $chkShake; } if (!empty($chkKetchup)){ print ("你选择了 Ketchup <br>"); $total = $total + $chkKetchup; } print "总计花费:\$$total"; ?> </body> </html> -->
[2]php实例:构建基于表单输入的查询字符串
来源: 互联网 发布时间: 2013-12-24
分享一个php实例,构造基于表单的一个查询字符串。
代码:
<?php /** * 根据选择的表单,构造 查询字符串 * by www. */ if (isset($_POST['submit'])) { $rowID = $_POST['id']; mysql_connect("192.168.10.10","user","password"); mysql_select_db("java2s"); $query = "SELECT * FROM Employee WHERE ID='$id'"; $result = mysql_query($query); list($name,$productid,$price,$description) = mysql_fetch_row($result); } ?> <form action="/blog_article/</php echo $_SERVER[.html'PHP_SELF']; ?>" method="post"> <select name="id"> <option name="">请选择一个雇员:</option> <option name="1">1</option> <option name="2">2</option> <option name="3">3</option> </select> <input type="submit" name="submit" value="确认提交" /> </form>
[3]php实例:CC(抄送)和BCC(密送)发送电子邮件
来源: 互联网 发布时间: 2013-12-24
php实现的抄送与密送电子邮件的代码,如下:
<HTML> <HEAD> <TITLE>发送邮件 with CC and BCC-www.</TITLE> </HEAD> <BODY> <FORM action="/blog_article/sendemailWithCC_BCC.html" method=post name=form1> <TABLE> <TBODY> <TR> <TD> <DIV align=right><b>To</b></DIV></TD> <TD> <p>Name <INPUT name=mailtoname size=35><BR>E-mail <INPUT name=mailtomail size=35></p></TD></TR> <TR> <TD> <DIV align=right><b>CC</b></DIV></TD> <TD><INPUT name=mailcc size=35> </TD></TR> <TR> <TD> <DIV align=right><b>BCC</b></DIV></TD> <TD><INPUT name=mailbcc size=35> </TD></TR> <TR> <TD> <DIV align=right><b>Priority</b></DIV></TD> <TD><SELECT name=mailpriority> <OPTION value=1>Highest</OPTION> <OPTION value=2>High</OPTION> <OPTION selected value=3>Normal</OPTION> <OPTION value=4>Low</OPTION> <OPTION value=5>Lowest</OPTION> </SELECT> </TD></TR> <TR> <TD><DIV align=right><b>邮件主题:</b></DIV></TD> <TD><INPUT name=mailsubject size=35></TD></TR> <TR> <TD> <DIV align=right><b>邮件内容:</b> </DIV></TD> <TD><TEXTAREA cols=50 name=mailbody rows=7></TEXTAREA> </TD></TR> <TR> <TD colSpan=2> <DIV align=center><INPUT name=Submit type=submit value="提交"></DIV> </TD> </TR> </TBODY> </TABLE> </FORM> </BODY> </HTML> <!-- sendemailWithCC_BCC.php <html> <head> <title>发送电子邮件-www.</title> </head> <body> <?php $message= " " ; if (empty ( $mailtoname) || empty ( $mailtomail) ) { die ( "收件人不能为空 ") ; }else{ $to = $mailtoname . " <" . $mailtomail . ">" ; } if ( empty ( $mailsubject) ) { $mailsubject=" "; } if (($mailpriority>0) && ($mailpriority<6)) { $mailheader = "X-Priority: ". $mailpriority ."\n"; } $mailheader.= "From: " . "Sales Team <sales@yourdomain.com>\n"; $mailheader.= "X-Sender: " . "support@yourdomain.com\n"; $mailheader.= "Return-Path: " . "support@yourdomain.com\n"; if (!empty($mailcc)) { $mailheader.= "Cc: " . $mailcc ."\n"; } if (!empty($mailbcc)) { $mailheader.= "Bcc: " . $mailbcc ."\n"; } if (empty($mailbody)) { $mailbody=" "; } $result = mail ($to, $mailsubject, $mailbody, $mailheader); echo "<center><b>Mail sent to ". "$to". "<br>"; echo $mailsubject. "<br>"; echo $mailbody. "<br>"; echo $mailheader. "<br>"; if ($result) { echo "<p><b>邮件发送成功!</b></p>"; }else{ echo "<p><b>邮件未能完成投递! </b></p>"; } ?> <div align="center"> <table><tr><td width="66"><div align="right"><b>To</b></div></td> <td width="308"><b><?php echo $mailtoname . " [". $mailtomail . " ]";?></b></td></tr> <tr><td width="66"><div align="right"><b>CC</b></div></td> <td width="308"><b><?php echo $mailcc;?></b></td></tr> <tr><td width="66"><div align="right"><b>BCC</b></div></td> <td width="308"><b><?php echo $mailbcc; ?></b></td></tr> <tr><td width="66"><div align="right"><b>Priority</b></div></td> <td width="308"><b><?php echo $mailpriority;?></b></td></tr> <tr><td width="66"><div align="right"><b>Subject </b></div></td> <td width="308"><b><?php echo $mailsubject;?></b></td></tr> <tr><td width="66"><div align="right"><b>Message</b></div></td> <td width="308"><b><?php echo $mailbody;?></b></td></tr> </table> </div> </body> </html> -->
最新技术文章: