[thelist] ASP and checkboxes

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Fri Oct 7 11:20:31 CDT 2005


Am I blind, or are there no checkboxes in this code?

   The first thing you should probably do is show us the code you have so far, so we can see if maybe there's a tiny mistake that just needs to be tweaked.

   If you want to grab stuff like this from the submitted form in ASP (I assume you mean old-school "Classic" ASP, and VBScript as your language of choice), I would suggest the following:

Dim iCheckIndex, iUpperBound
Dim sFieldValue

iUpperBound = whateverYouThinkItShouldBe

For iCheckIndex = 0 To iUpperBound
   sFieldValue = Request.Form("hb" & PadValue(iCheckIndex))
   If sFieldValue <> "" Then
      ' Do mail stuff
   End If
Next

Function PadValue(iParam)
   If Len(iParam) = 1 Then iParam = "0" & iParam

   PadValue = iParam
End Function

Hope that gets you started...

Peter

 From: "Kevin Stevens" kjs at ratking.co.uk

Afternoon all
I am having a problem with a form that should, I think, be 
easy but I cannot work out the solution. I have a table row with the 
following code...

value="hb01">	 
HB-01	 
2 Perry Road, Witham	 
Please choose quantity50010002500500010000	 

and after that, several more rows exactly the same but called HB-02, HB-03 
etc. Using the post method I want to send the details of any ticked boxes to 
an ASP page that sends an e-mail, but it is printing out everything, whether 
the box is ticked or not. I'm sure I need some kind of loop that only 
e-mails details of the ticked boxes but I can't figure out exactly how to do 
it. Can anyone provide me with any pointers?

TIA

Kevin Stevens
kjs at ratking.co.uk 


More information about the thelist mailing list