后台取相同name值的问题

A Hypertext Markup Lanugage (HTML) form may include several input fields that share the same name. If you use the Request.Form or Request.QueryString collection to access a field name, a string is returned that contains all values from all of the fields with the given field name, which are separated by a comma (,).

To access individual values, you can use the GetValues method to obtain an array of strings. You can then use the array elements to provide access to individual values. For example, in Microsoft Visual C# .NET, use the following code:

String[] tempArray;tempArray = Request.Form.GetValues("fieldName");Response.Write (tempArray[0]);  //Print the first value.
原文地址:https://www.cnblogs.com/hellohongfu/p/1852067.html