在经典 ASP 中添加逗号的 HTML 表单值

2022-01-16 00:00:00 forms asp-classic html

我有一个经典的 ASP 页面,它提交回自身.奇怪的是,从选择返回的值的末尾添加了逗号.有没有人遇到过这样的事情?有没有推荐的故障排除步骤或工具?

I have a classic ASP page that submits back to itself. Strangely, the values being returned from the selects have commas being added to the ends of them. Has anyone run into anything like this before? Any troubleshooting steps or tools recommended?

我希望这些值以数字形式返回 - 它们是选项中显示的值的 ID.

I'm expecting the values to be returned just as numbers - they are the IDs of the values displayed in the option.

我检查了页面中的神秘逗号,但找不到任何 - 也没有在我正在提取的数据中.

I've checked for mystery commas in the page and can't locate any - nor in the data that I'm pulling through.

(注意 - 这些是单选,而不是多选)

(note - these are single-selects, not multiple)

推荐答案

听起来您有重复的表单字段.您的值用逗号连接在一起,如下所示:

Sounds like you have duplicate form fields. Your values are concatenated together with commas, like this:

<input type="text" name="name1" value="value1">
<input type="text" name="name1" value="value2">
<input type="text" name="name2" value="value3">

变成

name1=value1,value2
name2=value3

如果第二个name1没有值,就变成

If the second name1 has no value, it becomes

name1=value1,
name2=value3

相关文章