<?php
if($submit)
{
if($chkme)
{
printf("你选择了CHECKBOX");
}
else
{
printf("你没有选择CHECKBOX");
}
}
else
{
?>
<html>
<head>
<meta charset="GB2312">
<title>测试提交</title>
</head>
<body>
<form action="<?php echo $PATH_INFO ?>" method=post>
<input type=checkbox checked name="chkme">选我
<input type=submit name=submit value="提交">
</form>
</body>
</html>
<?php
}
?>
<html>
<body>
<form action="xxx.php" onsubmit=“if(!document.getElementById('check').checked){alert('请选择!');return false;}”>
<input type="checkbox" id="check">
<input type="submit">
</form>
</body>
</html>
php数组的灵活应用
function addInput($a)
{
if(is_array($a))
{
$title = $a['title'];
$name = $a['name'];
$value = $a['value'] ? $a['value'] : "";
$type = $a['type'] ? $a['type'] : "text";
$maxlength = $a['maxlength'] ? $a['maxlength'] : "255";
$readonly = $a['readonly'] ? $a['readonly'] : "";
$required = $a['required'] ? $a['required'] : "false";
$check = $a['check'];
$id = $a['id'];
$width = $a['width'];
$tip = $a['tip'];
}
$title,$name,$value="",$type="text",$maxlength="255",$readonly,$required="false",$check,$id,$width,$tip
$this->form .= "<li>\n";
$this->form .= "<label>".$title.":</label>\n";
$this->form .= "<input name=\"".$name."\" value=\"".$value."\" type=\"".$type."\" maxlength=\"".$maxlength."\" required=\"".$required."\" check=\"".$check."\" id=\"".$id."\" class=\"input\" ".$readonly." style=\"width:".$width."px;\" showName=\"".$title."\" /> ";
$this->form .= "<span class=\"tip\">".$tip."</span>\n";
$this->form .= "</li>\n";
}
Fatal error: Call to undefined function mssql_connect() 这种提示是证明php与mssql数据库连接不成功,并且mssql_connect()这个函数不能使用
现在我们来看看解决方法:
第一步:查看你c:\php\目录下有ntwdblib.DLL这个文件吗?如果有再看查看你c:\windows\system32\目录下有没有这个文件ntwdblib.DLL如果还是有,但还是同样的提示错误就再看看c:\windows\system32\目录下有没有php_mssql.dll这个文件,如果没有就在你的php目录下C:\php\ext\找到php_mssqll.dll文件,如果有就找其它原因,看看你的php.ini里的;extension=php_ming.dll
;extension=php_mssql.dll
前面的;去了没,如果没有去了,重起apahce 试试看,大多数据这个时间会成功了,如果还是不行,就看看你php目录下的ntwdblib.dll版权是不是和你mssql server的版本相同,如果不同就把mssql目录下的拷贝到上面那几个寺主就行了.
这些方法都是我在实际中得来了,请各位转载注明来自:www.111cn.net
function br_num($a) //检查用户留言的换行数
{
for($b=0;$b<=strlen($a);$b=$c+1)
{
$c = strpos($a,"\n",$b);
if($c === false)
break;
$d++;
}
return $d;
}
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>交时自动复制到剪贴板</title>
</head>
<script language="JavaScript">
/*功能:提交时自动复制到剪贴板 */
function copyText(obj) {
ie = (document.all)? true:false
if (ie){
var rng = document.body.createTextRange();
rng.moveToElementText(obj);
rng.scrollIntoView();
rng.select();
rng.execCommand("Copy");
rng.collapse(false);
}
}
function autocopy() {
if (this.document.formname.isautocopy.checked) {
copyText(this.document.formname.icontent);
}
}
</script>
<body>
<form action="" method="post" name="formname" onsubmit="autocopy();">
<textarea name="icontent" rows="4" cols="50"></textarea><br>
<input name="isautocopy" checked="checked" value="1" type="checkbox" />
提交时复制内容到剪贴板<br/><input type="submit" value="提交" /> </form>
</body>
</html>