Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 9th, 2015, 09:57 PM
Registered User
Points: 19, Level: 1
Points: 19, Level: 1 Points: 19, Level: 1 Points: 19, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multiple Inserts from Multiple checkboxes

I have a page that first looks up a list of courses, as the results list is being built in HTML using classic ASP, I add a checkbox at the end of each <TR>. The checkbox name is built dynamically, i.e., each checkbox name is built as "checkbox1", checkbox2, etc. Each checkbox is assigned a value from two fields from each row of the objRS (resultset) so that the value is formed in the form of a value list of an sql insert clause.

The code that builds this RS is:

Code:
objRSschedule.Open strSQL, strConn, 3, 3

Response.Write "<table class=""auto-style5"" border=""0"" cellpadding=""1"" cellspacing=""0"" style=""vertical-align: bottom"">" &_
"<tr class=""auto-style7""><td colspan=""4""><b><u>List of Available Classes</u></b></TD></tr><P></P>" & _
"<P></P><tr class=""auto-style6""><td>Class Name |</TD><td> Class Date |</TD><td> Class Time |</TD><td> Enroll Me</TD></tr>"


Do Until objRSschedule.EOF = True
intChkBxVal = intChkBxVal + 1
Response.Write "<TR class=""auto-style5"">" & _
				"<td>" & objRSschedule ("ClassName") & "</TD>" & _
				"<td>" & objRSschedule ("ClassDate") & "</TD>" & _
				"<td>" & objRSschedule ("ClassTime") & "</TD>" & _
				"<td><input name=""Checkbox" & intChkBxVal & """type=""checkbox"" Value=""('" & strContactID &  "','" & objRSschedule("ClassID")& "')""></TD>" & _				
			
				"</TD></TR>"
The resulting HTML list looks like this:

List of Available Classes

Class Name |Class Date |Class Time |Enroll Me

Spin 1/12/2015 7:00 PM [checkbox]

Spin 1/17/2015 6:00 AM [checkbox]

Spin 1/26/2015 5:00 AM [checkbox]

TRX 1/27/2015 7:00 AM [checkbox]

If you were to inspect the checkbox elements presented on the web page, the resulting HTML code looks like this:

<input name="Checkbox1" type="checkbox" value="('1','160')">

AND

<input name="Checkbox2" type="checkbox" value="('1','159')"> ,
etc., for each class returned.

I would like the user to be able to check multiple checkboxes AND based on the boxes checked, have the value in the Value clause be the value of the insert clause to be entered into another table, classSignup. Ex.

INSERT INTO ClassSignup
VALUES ('1','159'); <----- this value string is what needs to be inserted in the ClassSignup table

Is there any way to do this without forcing the user to do a separate insert operation for for each box checked?
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Inserts ~Bean~ SQL Language 1 January 20th, 2006 03:00 PM
Trigger support for multiple Inserts kim3er SQL Server 2000 1 November 6th, 2004 02:51 AM
Multiple Checkboxes With same name how to make t kcs_chandra ASP.NET 1.0 and 1.1 Basics 1 October 29th, 2004 10:03 AM
Multiple Checkboxes Error mgreenwood BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 May 27th, 2004 03:43 PM
multiple dynamic checkboxes mlog Classic ASP Basics 0 February 14th, 2004 04:49 AM



All times are GMT -4. The time now is 08:12 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.