【问题标题】:IE7 and IE8 - why don't they remember select box values?IE7 和 IE8 - 为什么他们不记得选择框的值?
【发布时间】:2012-12-03 12:12:18
【问题描述】:

我有一个超级简单的表单,带有一个选择下拉框。除了 IE8 和 IE7(IE9 有效)之外,所有浏览器都会记住该选择。我正在做一个帖子。文档类型是 HTML。我还需要补充什么?

print_R($_POST) 在所有浏览器中正确显示值,包括 IE9 - 除了 IE 7 和 IE8

<form method='POST' action='/someaction'>
    Timezone : 
    <select name='user_time_zone' id='user_time_zone'>
        <option value='UTC'>UTC/GMT</option>
        more options here
    </select>
    <input type='submit' value='Set' style='padding-left: 5px; height: 30px; margin-bottom: 10px;'>
</form>

【问题讨论】:

  • 还记得什么时候吗?使用后退按钮?还是重新访问页面?
  • 当我提交表单并打印 POST 变量时,它不包含正确的值
  • 发布您的 PHP 和 HTML 代码...
  • @user187809 如果服务器端代码不包含已发布表单的正确值,则问题出在浏览器上。问题是别的 - 请发布所有相关的服务器端代码

标签: html internet-explorer


【解决方案1】:

我怀疑您的问题不在于您的浏览器,而在于您的代码。使用http://browserstack.com,我能够启动Windows XP 的快速虚拟机并测试IE7 和IE8。此外,我在本地机器上测试了 IE10 - 所有浏览器 showed the posted data 符合预期。

<?php

    if (count($_POST)) var_dump($_POST);

?>
<form method='post'>
    <label for="user_time_zome">Timezone:</label> 
    <select name='user_time_zone' id='user_time_zone'>
        <option value='foo'>Foo</option>
        <option value="bar">Bar</option>
    </select>
    <input type='submit' value='Set'>
</form>

样本输出:

array
  'user_time_zone' => string 'foo' (length=3)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-11-12
    • 2012-01-08
    • 1970-01-01
    • 2011-02-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多