请教一个php 问题。
index.html
<.... gb2312>
<form action="sss.php" method="get">
<input type="text" name="key" value="text_value"/>
</form>
在 sss.php 里面
<iframe src="aaa.html?<?php echo $key?>" >
在 aaa.html 里面
function set_value() {
document.getElementById("su_text").value = location.search
}<input type="text" id="su_text" />为什么 每次,su_text 里显示都是,gb2312 的数字编码, 而不是 gb2312 的汉字本身?大家一般怎么把一个字符串传给另一个页面?谢谢!!
index.html
<.... gb2312>
<form action="sss.php" method="get">
<input type="text" name="key" value="text_value"/>
</form>
在 sss.php 里面
<iframe src="aaa.html?<?php echo $key?>" >
在 aaa.html 里面
function set_value() {
document.getElementById("su_text").value = location.search
}<input type="text" id="su_text" />为什么 每次,su_text 里显示都是,gb2312 的数字编码, 而不是 gb2312 的汉字本身?大家一般怎么把一个字符串传给另一个页面?谢谢!!
php接收后最好判断转换一下
本质问题是这样。
php 收到了 %B9%FE%B9%FE 的字符串 (这是“哈哈”的gb2312的数字编码)然后,php 要echo 出一个 <input type="text"> 的输入框。
怎么让输入框中显示 “哈哈” 。
我多次尝试, 输入框中显示的都是 数字编码。谢谢!!
当 php 只有 %B9%FE%B9%FE 字符串时,怎么才能让 输出的页面 ,显示 “哈哈”。
并且 收到 %B9%FE%B9%FE 时。
这样
document.getElementById("su_text").value = "%B9%FE%B9%FE"
并不能使
<input class="s_text" name="s_keywords" id="su_text" type="text" size="30" style="height:32" />
显示 “哈哈”显示的是 “%B9%FE%B9%FE”本身。
该怎么办,才能显示“哈哈”?
document.getElementById("su_text").value = unescape(location.search);
帖出你的代码
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
</HEAD>
<BODY >
<form action="form_test_osu.php" method="get">
<input class="u_text" type="text" id="su_text" name="s_keywords" size="40" alt="left" />
<input id="do_search" class="u_button" type="submit" value="查找" />
</form>
</BODY>
</HTML>form_test_osu.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> sugoogle </TITLE>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
</HEAD>
<?php
$s_keyword = $_GET["s_keywords"];
?><frameset id="f_screen" rows="18%,*">
<frame src="form_test_top.html?<?php echo $s_keyword;?>'"/>
</frameset>
</HTML>
form_test_top.html
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" /><SCRIPT type="text/javascript">function doset(){
document.getElementById("su_text").value = (location.search);
}
</SCRIPT>
</head>
<body onload="doset()">
<input class="s_text" name="s_keywords" id="su_text" type="text" size="30" style="height:32" />
<input class="c_search_button" id="do_search" type="submit" style="width:60" value="查找" />
</body>
</html>
index.html<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
</HEAD>
<BODY >
<form action="form_test_osa.php" method="get">
<input class="u_text" type="text" id="su_text" name="s_keywords" size="40" alt="left" />
<input id="do_search" class="u_button" type="submit" value="查找" />
</form>
</BODY>
</HTML>form_test_osa.php<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> sugoogle </TITLE>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
</HEAD>
<?php
$s_keyword = $_GET["s_keywords"];
?><frameset id="f_screen" rows="18%,*">
<frame src="form_test_top.html?<?php echo $s_keyword;?>"/>
</frameset><noframes></noframes>
</HTML>
form_test_top.html<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" /><SCRIPT type="text/javascript">function doset(){
document.getElementById("su_text").value = (location.search.substr(1));<!--我把location.search改成了location.search.substr(1),目的是为了去掉前面的问题?-->
}
</SCRIPT>
</head>
<body onLoad="doset()">
<input class="s_text" name="s_keywords" id="su_text" type="text" size="30" style="height:32" />
<input class="c_search_button" id="do_search" type="submit" style="width:60" value="查找" />
</body>
</html>
例如 “哈哈 哦哦”
那么在 submit 后 url 表示为 “哈哈+++哦哦”然后,php 处理后,在返回给 第二个 html 。按照这种方法, 显示的是 “哈哈+++哦哦”我的问题是 怎么去掉 中间的 +++ ?