请教一个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 的汉字本身?大家一般怎么把一个字符串传给另一个页面?谢谢!!

解决方案 »

  1.   

    现在的浏览器基本以utf-8传递多字节字符url,类似%xx的形式
    php接收后最好判断转换一下
      

  2.   

    谢谢大家关注。
     本质问题是这样。
    php 收到了 %B9%FE%B9%FE  的字符串 (这是“哈哈”的gb2312的数字编码)然后,php 要echo 出一个  <input type="text"> 的输入框。
       怎么让输入框中显示 “哈哈” 。
    我多次尝试, 输入框中显示的都是 数字编码。谢谢!!
      

  3.   

    这么说更简单。
       当 php  只有 %B9%FE%B9%FE  字符串时,怎么才能让 输出的页面 ,显示 “哈哈”。
      

  4.   

    哦 ,这个还和 php 无关。   当页面为 <meta http-equiv="content-type" content="text/html; charset=gb2312" />
     
         并且 收到 %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”本身。
    该怎么办,才能显示“哈哈”?
      

  5.   

    PHP编码的URL,js再解码肯定不可以,不一样的编码方式
      

  6.   

    window.location.href="sss.php?key="+escape('好啊')+"";
    document.getElementById("su_text").value = unescape(location.search);
      

  7.   

    %B9%FE%B9%FE 是 url 编码,解码的过程由为恶补服务器自动完成,所以你接收到的也就是“哈哈”
    帖出你的代码
      

  8.   

    代码太长,我精简了下,运行后仍然能复现我的问题。index.html
    <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>
      

  9.   

    我试了一下你的代码,显示的是汉字:
    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>
      

  10.   

    用 火狐 就hui会出错。。 
      

  11.   

    把sss.php的页面编码设置一下,和index.html的编码一致
      

  12.   

    这里 还 个 问题, 当输入的  是带空格的字符串 时候。
       例如  “哈哈   哦哦”
    那么在 submit 后 url  表示为  “哈哈+++哦哦”然后,php 处理后,在返回给 第二个 html 。按照这种方法, 显示的是   “哈哈+++哦哦”我的问题是 怎么去掉  中间的 +++  ?