易截截图软件、单文件、免安装、纯绿色、仅160KB

php学习笔记(12):PHP+MYSQL留言板(下

1、提交表单Javascript验证
<form action="" method="post" name="myform" onsubmit="return CheckPost();">
SCRIPT language=javascript>
function CheckPost()
{
 
if (myform.user.value=="")
 {
  alert("请填写用户");
  myform.user.focus();
  return false;
 }
 if (myform.title.value.length<5)
 {
  alert("标题不能少于5个字符");
  myform.title.focus();
……
}
2、str_replace替换函数
替换的值,被替换的内容);
function htmtocode($content) {
   $content = str_replace("\n", "<br>", str_replace(" ", "&nbsp;", $content));
   return $content;
}
3、htmlspecialchars 格式化html
主要功能是将HTML格式化,防止在输出html时被浏览器执行
htmlspecialchars(所要格式化对象,定义单双引号,编码)
4、md5加密函数
md5( 加密对象 )
hearder.php:
<?php
/*
* Created on 2010-1-5
* Author :CHAUVET
* Function:被包含在其他页面的头部页面,演示include()
*/
function ReplaceSomeWords($words){
$words=str_replace("\n","<br/>",str_replace(" "," ",$words));
return $words;
}
?>
<a href="add.php" mce_href="add.php">添加页面</a>|<a href="list.php" mce_href="list.php">查看页面</a>|<a href="add.php" mce_href="add.php">登陆页面</a><br/>
<hr/>

add.php:
 <html>
 <head>
  <title>添加页面</title>
  <style type="text/css">
   body{font-size:12px;text-align:center;}
   #capation{font-size:24px;font-famliy:"华文新魏";}
  </style>
  <script type="text/javascript">
   function ClearInputWords(){
    document.myForm[0].value="";
    document.myForm[1].value="";
    document.myForm[2].value="请在此输入您的留言!";
   }
   function CheckInput(){
 &nb


相关文档:

comparing strings in PHP with the == operator

最近在Greg Beaver's的blog上发表的一篇新文章 comparing strings in PHP with the == operator 中提及了PHP的 == 运算符在对字符串进行比较时值得注意的问题。
在某些情况下,PHP会把类数值数据(如含有数字的字符串等)转换成数值处理,== 运算符就是其中之一。在使用 == 运算符对两个字符串进行松散比较时,PHP会把类数 ......

php学习笔记(12):PHP+MYSQL留言板(上

require()  与  require_once()
    
      通常放在 PHP 程序的最前面,PHP 程序在执行前,就会先读入 require
所指定引入的文件,如果出现错误是致命的。
nclude()  与  include_once()
    
    &n ......

PHP工程师笔试题

 一个公司简单的面试题:
1. 简答题
(1)一些相关LINUX方面的指令操作eg: mkdir 创建目录 touch 创建文件夹以及修改权限chmod之类等等
(2)简述不同版本的PHP有什么区别,试举例简述.
(3),简述接口技术的好处,试举例简述.
(4)如何使用下面的类,并解释下面什么意思?
class test{
    function ......

MySQL 一次执行多条语句的实现及常见问题

代码如下:
//链接时设定
mysql_real_connect( ..., CLIENT_MULTI_STATEMENTS );
//或者
//中途指定
mysql_set_server_option( mysql, MYSQL_OPTION_MULTI_STATEMENTS_ON ); //mysql是连接的名称
当使用执行多语句功能后,一定要读完整个resault集,否则会出现错误:Commands out of sync; you can't run this co ......

mysql 创建表并设置主键自增

mysql 创建表:
mysql> create table user(
    -> userid int(4) primary key not null auto_increment,
    -> username varchar(16) not null,
    -> userpassword varchar(32) not null
    -> );
create table log(
logid int(4) ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号