alias92 Posted September 3, 2009 Share Posted September 3, 2009 i have a problem on checkboxes.<% counter3 = 0 dim gunler, guns, gun() gunler=split(dates,",") Redim gun(40) For each guns in gunler 'response.write "<br>gun(" & counter3 & ")=" & guns counter3 =counter3 + 1 Next counter2 = 0 For i = Cdate(start_date) to Cdate(end_date) If WeekdayName(Weekday(start_date)) <> "Sunday" Then %><input type="checkbox" name="dates" id="dates" value="<%=Cdate(start_date)%>" <%if CDate(start_date) = gunler(counter2) Then%> checked <%End If%>> <%=Cdate(start_date)%> - <%=WeekdayName(Weekday(start_date))%> <% End If start_date = DateAdd("d",1,start_date) counter2 = counter2 + 1 %><br> <%Next%> this is my code.i want to get checked checkbox from dbbut i cannot get checked checkbox because i write on db only checked, if i can write unchecked checkbox , i will be get the true solution.please give me a big helpgun(0)=22.08.2009gun(1)= 24.08.2009gun(2)= 25.08.2009gun(3)= 29.08.2009gun(4)= 01.09.2009gun(5)= 03.09.2009gun(6)= 04.09.2009gun(7)= 08.09.200922.08.2009 - Sat 24.08.2009 - Mon25.08.2009 - Tue26.08.2009 - Wed27.08.2009 - Thu28.08.2009 - Fri29.08.2009 - Sat31.08.2009 - Mon01.09.2009 - Tue02.09.2009 - Wed03.09.2009 - Thu04.09.2009 - Fri05.09.2009 - Sat07.09.2009 - Mon08.09.2009 - Tue09.09.2009 - Wed10.09.2009 - Thu11.09.2009 - Fri12.09.2009 - Sat14.09.2009 - Mon15.09.2009 - Tue Link to comment Share on other sites More sharing options...
justsomeguy Posted September 3, 2009 Share Posted September 3, 2009 If you want look at all of the boxes instead of only the ones that were checked, you need to loop through all of the checkbox names like you do when you write them out, and for each one see if it was submitted. In that case, it will probably help if you name each checkbox differently instead of calling them all the same thing. Link to comment Share on other sites More sharing options...
alias92 Posted September 3, 2009 Author Share Posted September 3, 2009 please give me an example for your suggest Link to comment Share on other sites More sharing options...
justsomeguy Posted September 4, 2009 Share Posted September 4, 2009 You already have a counter, so might as well use that for the name.counter2 = 0For i = Cdate(start_date) to Cdate(end_date) If WeekdayName(Weekday(start_date)) <> "Sunday" Then %><input type="checkbox" name="cb_<%=counter2%>" id="dates" value="<%=Cdate(start_date)%>" <%if CDate(start_date) = gunler(counter2) Then%> checked <%End If%>><%=Cdate(start_date)%> - <%=WeekdayName(Weekday(start_date))%><%End Ifstart_date = DateAdd("d",1,start_date)counter2 = counter2 + 1%><br><%Next%>Then to read them you do the same loop, and get each one by name. counter = 0For i = Cdate(start_date) to Cdate(end_date) cb = Request.Form("cb_" & counter) ... do whatever with cb counter = counter + 1Next Link to comment Share on other sites More sharing options...
alias92 Posted September 5, 2009 Author Share Posted September 5, 2009 thank u very much it worksi used counter and get values if null then write 0. then <%If instr(1, dates, start_date)<> 0 Then%> checked <%End If%> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.