Hola
Prueba con este ejemplo para que entiendas como ha de funcionar
Código HTML:
Ver original<form action="tarifes_admin.asp?accio=edita" method="post"> <td>Actualizada (Fecha /Hora)
</td> <td><input type="text" id="txt1" name="cam_form" value="" tabindex="2" /></td> <td><input type="text" id="txt11" name="cam_form" value="" tabindex="3" /></td> <td><input type="text" id="txt111" name="cam_form" value="" tabindex="4" /></td> <td><input type="text" id="txt2" name="cam_form" value="" tabindex="6" /></td> <td><input type="text" id="txt22" name="cam_form" value="" tabindex="7" /></td> <td><input type="text" id="txt222" name="cam_form" value="" tabindex="8" /></td> <td><input type="text" id="txt3" name="cam_form" value="" tabindex="10" /></td> <td><input type="text" id="txt33" name="cam_form" value="" tabindex="11" /></td> <td><input type="text" id="txt333" name="cam_form" value="" tabindex="12" /></td> <td><input type="text" id="txt4" name="cam_form" value="" tabindex="14" /></td> <td><input type="text" id="txt44" name="cam_form" value="" tabindex="15" /></td> <td><input type="text" id="txt444" name="cam_form" value="" tabindex="16" /></td> <input type="submit" value="Enviar" />
tarifes_admin.asp
Código ASP:
Ver original<%
Dim Arr() ' Valores de todos los campos recibidos
For each campo in Request.Form
valCampos = valCampos & Request.Form(campo)
Next
division = Split(valCampos, ",")
for i = 0 to UBound(division)
Redim preserve Arr(i+1)
Arr(i) = Trim(division(i))
next
Dim Arr2() ' Valores del primer campo de cada tr
Dim Arr3() ' Valores del segundo campo de cada tr
Dim Arr4() ' Valores del tercer campo de cada tr
Dim Arr5() ' Valores del cuarto campo de cada tr
j = 0
for i = 0 to ubound(Arr)-1 step 4
if Arr(i) <> "" then
Redim preserve Arr2(j)
Arr2(j) = Arr(i)
j = j +1
end if
next
x = 0
for i = 1 to ubound(Arr)-1 step 4
if Arr(i) <> "" then
Redim preserve Arr3(x)
Arr3(x) = Arr(i)
x = x +1
end if
next
p = 0
for i = 2 to ubound(Arr)-1 step 4
if Arr(i) <> "" then
Redim preserve Arr4(p)
Arr4(p) = Arr(i)
p = p +1
end if
next
z = 0
for i = 3 to ubound(Arr)-1 step 4
if Arr(i) <> "" then
Redim preserve Arr5(z)
Arr5(z) = Arr(i)
z = z +1
end if
next
'conexión bd
for i = 0 to j-1
SQL="UPDATE tabla SET camp1='"&Arr2(i)&"', camp2='"&Arr3(i)&"', camp3='"&Arr4(i)&"' WHERE camp4 ='"&Arr5(i)&"'"
oConn.Execute(SQL)
next 'i
oConn.Close
set oConn = nothing
Response.Write("Todo acabó bien")
%>
Suerte