I have the following code below, and when I click the record button, I execute the first two responses. But they are printing empty fields. What's wrong with my code?
CODE:
<%
Dim year_, lista(), cList, x, vHol()
year_=year(date())
response.write request.form("lista(0,1)")
response.write request.form("valor_1")
call LoadUsers()
%>
<form action="layOff.asp?sid=<%=sid%>&opc=sav" method="POST" name="form" style="margin-top:0;">
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class=Font9Bold><br><%=msg("90130", lng)%></td>
</tr>
<tr height="25" bgcolor="#efefef">
<td colspan=3 style="border-color:'navy';border-style:solid;border-top-width:1px;border-bottom-width:1px;border-right-width:0px;border-left-width:0px;">
<input class=Button type="submit" name="submit" value=" <%=msg("50001", lng)%> ">
<input class=Button type="Button" name="Submit" value=" <%=msg("50002", lng)%> " OnClick="location.href='../mnt/manut.asp?sid=<%=sid%>'">
</td>
</tr>
<tr height="30">
<td><br/></td>
</tr>
<tr>
<td class=Font9Red colspan=2>
<%=sMsg%>
</td>
</tr>
</table>
<table width="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr height="25" bgcolor="#efefef" class=Font10Bold>
<td width="50" style="border-color:'navy';border-style:solid;border-top-width:1px;border-bottom-width:1px;border-right-width:0px;border-left-width:0px;">
<%=msg("90002", lng)%>
</td>
<td width="400" style="border-color:'navy';border-style:solid;border-top-width:1px;border-bottom-width:1px;border-right-width:0px;border-left-width:0px;">
<%=msg("90033", lng)%>
</td>
<td align="center" width="60" style="border-color:'navy';border-style:solid;border-top-width:1px;border-bottom-width:1px;border-right-width:0px;border-left-width:0px;">
<%=msg("90130", lng) & " " & year_%>
</td>
</tr>
<% FOR x=0 to cList-1%>
<tr class='Font10'>
<td><%=lista(x,1)%></td>
<td><%=lista(x,2)%></td>
<td align="center"><input class=NumberBox type="text" name="valor_<%=x%>" value="<%=ValueHol(lista(x,0))%>" size="3" maxlength="2"></td>
</tr>
<%NEXT%>
</table>
<br/><br/><br/><br/>
</form>
<%
Function LoadUsers()
Dim y, i
sSQL="SELECT tbUsers.uid, tbUsers.user_, tbUsers.name "
sSQL=sSQL & "FROM tbUsers "
sSQL=sSQL & "WHERE user_<>'ADMIN' "
sSQL=sSQL & " ORDER BY name"
Set RS = MyConn.Execute(sSQL)
cList=0
while not rs.EOF
cList=cList+1
rs.MoveNext
wend
Set RS = MyConn.Execute(sSQL)
redim lista(cList,2)
i=0
while not rs.EOF
lista(i,0)=rs("uid")
lista(i,1)=rs("user_")
lista(i,2)=rs("name")
i=i+1
rs.MoveNext
wend
End Function
Function ValueHol(uid)
sSQL="SELECT days_year "
sSQL=sSQL & "FROM tbLayOffTop "
sSQL=sSQL & "WHERE uid='" & uid & "'"
Set RS = MyConn.Execute(sSQL)
if not rs.eof then
ValueHol=rs("days_year")
end if
End Function
Sub save()
For i=0 to cList-1
sSQL="DELETE * FROM tbLayOff WHERE year_='" & year_ & "' AND month_='" & i & "' AND uid=" & lista(i,0)
Set RS = MyConn.Execute(sSQL)
sSQL="INSERT INTO tbLayOff (year_, uid, days_year"
sSQL2="insert_by, insert_date) "
sSQL3="VALUES ('" & year_ & "', '" & lista(i,0) & "', " & document.all("valor_" + cstr(i)).value & "', "
sSQL=sSQL & sSQL2 & sSQL3 & "'" & uid & "', " & "'" & date_now & "')"
response.write sSQL
Next
End Sub
%>