snowboardr
Programmer
What I want to do is update records depending on the if the record was checked or unchecked. I have tried a few ways of doing this but I can't seem to get them to work. On this way below it only returns 1 checked box that is checked, if anymore are checked, it just returns all user ids..
Is there a better way of doing this, or do you see why this way isnt working?
www.vzio.com
ASP WEB DEVELOPMENT
Is there a better way of doing this, or do you see why this way isnt working?
Code:
<form name="form1" method="post" action="check.asp">
<input type="checkbox" name="payed" value="1">
<input type="hidden" name="alluserids" value="1">
<input type="checkbox" name="payed" value="2">
<input type="hidden" name="alluserids" value="2">
<input type="checkbox" name="payed" value="3">
<input type="hidden" name="alluserids" value="3">
<input type="checkbox" name="payed" value="4">
<input type="hidden" name="alluserids" value="4">
<input type="checkbox" name="payed" value="5">
<input type="hidden" name="alluserids" value="5">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="save" value="true">
</form>
<%
If Request.Form("save") = "true" then
Dim frmAlluserids, frmPayed
Dim tmpFrmPayed, tmpAll
Dim IDsPayed, IDsNotPayed
Dim TmpPayedID
Dim TmpNotPayedID
frmAll = Request.Form("alluserids")
frmPayed = Request.Form("payed")
tmpAll = Replace(frmAll, ", ", ",")
tmpFrmPayed = Replace(frmPayed, ", ", ",")
frmAll = Split(tmpAll,",")
For each check in frmAll
If Instr(check,tmpFrmPayed) > 0 then
IDsPayed = IDsPayed & space(1) & check
End If
If Instr(check,tmpFrmPayed) < 1 then
IDsNotPayed = IDsNotPayed & space(1) & check
End If
Next
TmpPayedID = Trim(IDsPayed)
TmpNotPayedID = Trim(IDsNotPayed)
IDsPayed = Replace(TmpPayedID, " ", ", ")
IDsNotPayed = Replace(TmpNotPayedID, " ", ", ")
Response.Write IDsPayed & "<br><br>IDs not checked" & IDsNotPayed
End if
%>
ASP WEB DEVELOPMENT