输入标签内的 HTML 名称属性中允许使用哪些字符? [英] What characters are allowed in the HTML Name attribute inside input tag?

查看:45
本文介绍了输入标签内的 HTML 名称属性中允许使用哪些字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 PHP 脚本,可以动态生成 s,所以我想知道是否需要过滤 name 属性中的任何字符.>

我知道名字必须以字母开头,但是我不知道任何其他规则.我认为必须允许使用方括号,因为 PHP 使用这些方括号从表单数据创建数组.括号呢?空格?

解决方案

对于可以出现在表单控件名称中的字符的唯一真正限制是使用 GET 提交表单时

get"方法将表单数据集值限制为 ASCII 字符."参考

有一个很好的主题 这里.

I have a PHP script that will generate <input>s dynamically, so I was wondering if I needed to filter any characters in the name attribute.

I know that the name has to start with a letter, but I don't know any other rules. I figure square brackets must be allowed, since PHP uses these to create arrays from form data. How about parentheses? Spaces?

解决方案

The only real restriction on what characters can appear in form control names is when a form is submitted with GET

"The "get" method restricts form data set values to ASCII characters." reference

There's a good thread on it here.

这篇关于输入标签内的 HTML 名称属性中允许使用哪些字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆