当前位置:  编程技术>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>
-->

    
最新技术文章:
▪PHP函数microtime()时间戳的定义与用法
▪PHP单一入口之apache配置内容
▪PHP数组排序方法总结(收藏)
▪php数组排序方法大全(脚本学堂整理奉献)
▪php数组排序的几个函数(附实例)
▪php二维数组排序(实例)
▪php根据键值对二维数组排序的小例子
▪php验证码(附截图)
▪php数组长度的获取方法(三个实例)
▪php获取数组长度的方法举例
▪判断php数组维度(php数组长度)的方法
▪php获取图片的exif信息的示例代码
▪PHP 数组key长度对性能的影响实例分析
▪php函数指定默认值的方法示例
▪php提交表单到当前页面、提交表单后页面重定...
▪php四舍五入的三种实现方法
▪php获得数组长度(元素个数)的方法
▪php日期函数的简单示例代码
▪php数学函数的简单示例代码
▪php字符串函数的简单示例代码
▪php文件下载代码(多浏览器兼容、支持中文文...
▪php实现文件下载、支持中文文件名的示例代码...
▪php文件下载(防止中文文件名乱码)的示例代码
▪解决PHP文件下载时中文文件名乱码的问题
▪php数组去重(一维、二维数组去重)的简单示例
▪php小数点后取两位的三种实现方法
▪php Redis 队列服务的简单示例
▪PHP导出excel时数字变为科学计数的解决方法
▪PHP数组根据值获取Key的简单示例
▪php数组去重的函数代码示例
 


站内导航:


特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

©2012-2021,,E-mail:www_#163.com(请将#改为@)

浙ICP备11055608号-3