【发布时间】:2016-01-20 14:51:15
【问题描述】:
这里是新手 Web 开发人员。我正在为我的网站构建一个联系订单表格,我正在使用的相关字段使用单选按钮为用户提供 X 和 Y 之间的选项。如果我使用的是破折号,它会很好地显示在事物的视觉方面,但无论我是否使用破折号字符作为选项的值,如果有任何错误,它都不会保留该值。请允许我解释一下。
<div class="fieldwrap">
<div class="formlabel">
<p>Color Options<span style="color:red">*</span></p>
</div>
<label>
<input type="radio" value="As shown—without logo" name="color"
<?php if ($fields['Color']=='As shown—without logo') echo 'checked="checked"' ; ?>>
As shown—without logo
</label><br>
<label>
<input type="radio" value="As shown—with logo" name="color"
<?php if ($fields['Color']=='As shown—with logo') echo 'checked ="checked"' ; ?>>
As shown—with logo</label>
</div>
所以我试图确保它会在表单返回错误的情况下保持该选项处于选中状态,这通常是由于表单验证或用户输入不正确。
现在,这在 Chrome 和 Internet Explorer 中可以正常工作,但 Firefox 不会检查这些值。我 99% 确定这与我的 charset 属性有关,我的设置为:
<meta charset="UTF-8">
我需要做些什么才能让它在所有浏览器中正常运行有什么想法吗?
谢谢!
编辑:这是我在 Firefox 中运行 var_dump($_REQUEST); 时得到的结果。
array(15) { ["requiredinput"]=> string(0) "" ["productname"]=> string(18) "圣诞树盒" ["quantity"]=> string(2) "12 " ["size"]=> string(24) "3.75" x 2.1875" x 3.625"" ["color"]=> string(12) "无标志" ["coat"]=> string(4) "无" ["duedate"]=> string(0) "" ["jobname"]=> string(0) "" ["cmets"]=> string(0) "" ["name"]=> string(0 ) "" ["company"]=> string(0) "" ["phone"]=> string(0) "" ["fax"]=> string(0) "" ["email"]=> string (0) "" ["PHPSESSID"]=> 字符串(32) "003cb8367fd4f8dac28e9efaae8d03b4" }
【问题讨论】:
-
注意:dash 标签指的是
dashshell,而不是同名的标点符号。 -
您应该使用更简单的值,例如
with_logo、without_logo。 Em Dashes 等只需要在 UI 中,您不需要它们作为后端中的数据。
标签: javascript php em hyphen