<DIV id=fm>
<form name="free" method="get" action='news.php' >
<input type="text" name=edit class="STYLE2" id=kw maxlength=150>
<SPAN class=btn_wr>
<INPUT type="submit" class=btn id=su
value="检 索" >
</SPAN>
</FORM>
</DIV>
首先判断输入框edit的内容是否为空,若非空跳转到news.php页面,且把值传给news.php中的edit2。
该怎么写。本人是PHP初学,请大哥大姐指点
<form name="free" method="get" action='news.php' >
<input type="text" name=edit class="STYLE2" id=kw maxlength=150>
<SPAN class=btn_wr>
<INPUT type="submit" class=btn id=su
value="检 索" >
</SPAN>
</FORM>
</DIV>
首先判断输入框edit的内容是否为空,若非空跳转到news.php页面,且把值传给news.php中的edit2。
该怎么写。本人是PHP初学,请大哥大姐指点
解决方案 »
- php实现把图片上传到ftp上的代码,php新手。。。
- php文件需要帮助?
- Rewrite 二级域名的问题
- 采集,得到名字,select后,
- eaccelerator使php定时死掉的问题?
- 求一个问题,急,大家都碰到过的,
- 上传文件时如何捕捉错误?
- 快来看呀,关于FTP的问题...
- ::::::在线等待:::::::::php如果实现远程数据库连接!(mysql)
- 用sql插入数据时出错
- php连不上mysql,Warning: mysql_connect() [function.mysql-connect]: [2002] 由于连接方在一段时间
- 用iconv+imagettftext,输出中文字符,哪里错了
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function checkSubmit() {
var kw = document.getElementById('kw').value;
if (kw.length < 1) {
alert('请输入!');
return false;
}
return true;
}
</script>
</head><body>
<div id="fm">
<form name="free" method="get" action='news.php' onsubmit="return checkSubmit();">
<input type="text" name=edit class="STYLE2" id="kw" maxlength="150">
<span class="btn_wr">
<input type="submit" class="btn" id="su" value="检 索" >
</span>
</form>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function checkSubmit() {
var kw = document.getElementById('kw').value;
if (kw.length < 1) {
alert('请输入!');
return false;
}
return true;
}
</script>
</head><body>
<div id="fm">
<form name="free" method="get" action='news.php' onsubmit="return checkSubmit();">
<input type="text" name=edit class="STYLE2" id="kw" maxlength="150">
<span class="btn_wr">
<input type="submit" class="btn" id="su" value="检 索" >
</span>
</form>
</div>
</body>
</html>
if(str){
document.action = "news.php?v="+str;
}在news.php页面,$_GET['v']就是从上一个页面传过来的值。
if(str){
document.action = "news.php?v="+escape(str);
}
因此,对于中文字符串来说,假如不希望把字符串编码格式转化成UTF-8格式的(比如原页面和目标页面的charset是一致的时候),只需要使用escape。假如你的页面是GB2312或者其他的编码,而接受参数的页面是UTF-8编码的,就要采用encodeURI或者encodeURIComponent。在php页面用获取值urldecode($_GET['v']);
javascript : encodeURIComponent( html )
php::$html [直接获得,和urlencode得到的数据一样]
php向javascript传递敏感字符串
php:htmlspecialchars( $html )
javascript: decodeURIComponent( html )