小编use*_*802的帖子

ASP动态多维数组

ASP新手。尝试从表单创建多维数组。在PHP中这就像

<?php 
    $myArray = array();
    for($i = 0 $i< $myArray.size() $i++){ 

    myArray[$i] = array(field1=>"var1",field2=>var2);
    }
?> //syntax not exactly correct but you get the picture
Run Code Online (Sandbox Code Playgroud)

我必须在ASP中做类似的事情,但是我似乎可以弄清楚,尽管它应该很简单

我需要从表单的行中获取完成的值,然后将值放入数组中

Function getResults(totalRows)

dim results() 'my array for results
for i = 0 to totalRows - 1 

color = request.form("color"&i)
width = request.form("width"&i)
height = request.form("height"&i)


results(i)("color") = color
results(i)("height") = height
results(i)("width") =  width

response.write("color is " &results(i)("color")
response.write("color is " &results(i)("height")
response.write("color is " &results(i)("width")
NEXT
Run Code Online (Sandbox Code Playgroud)

结束功能

我需要返回此数组以使用它,在此先感谢,我尝试过在线查找,但似乎无法解决。

multidimensional-array asp-classic

1
推荐指数
1
解决办法
9672
查看次数