repost, sort of--dynamic checkboxes

M

middletree

Hate to post this in a separate post, but felt that the last thread was too
far down to get noticed. It is called dynamic checkboxes, and it contained
some good advice for me, but it led to another question, and I wanted to go
ahead and post my question here in hopes of getting an answer.

The advice given to me about having a number of checkboxes which are put
onto the page from the database, was to name them all the same thing, and
then, on the next page, do a request.form of that form field name, and it
would return a string.

This worked very well, and I confirmed that if I checked boxes 3, 5, and 9,
I would get (3,5,9) returned to me. However, I am not sure how I can get
these values stored into my database. In my case, I'll want to store the
person's ID, called PersonalID, which I will get another way. Let's assume I
have that value, and it's '1'. I want to insert 1,3 then 1,5, then 1,9 into
the table, into the fields PersonalID and PeopleID, respectively. That's 3
rows in that table, and it is dynamic, so a user could enter 0 to many rows
into this table.

Can someone help me get this syntax? There was a suggestion in the last post
offered to me, but I didn't get it at all.
 
T

Tim Williams

something like....

dim sChecks, arrChecks, personId, x, sSQL

personId=[whereever you get it from]
sChecks=request.form("checkbox_name") & ""

if len(sChecks)>0 then

arrChecks=split(sChecks,",")

for x=lbound(arrChecks) to ubound(arrChecks)

sSQL="insert into ....." 'insert SQL using arrChecks(x) and
personId
oConn.execute sSQL...
next
end if

tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top