I was using passed variables from a form. Then needed to add a record for each checkbox ticked. Code below, not all my own work but adapted to my requirements and taken from many sources.
<%@LANGUAGE="VBSCRIPT"%>
<%
dim num
dim xide
dim sql
' create an array of checkbox vallues then loop through it
xide=split(request.querystring("checkbox",",",-1,1)
for each num in xide
' declaring variables
Dim DataConn
Dim CmdAddRecord
Dim MYSQL
' set connection
Set DataConn = Server.CreateObject("ADODB.Connection"
Set CmdAddRecord = Server.CreateObject("ADODB.Recordset"
' Open the connection
DataConn.Open "DSN=dsnMeetings"
MYSQL = "SELECT * FROM tbBookings"
CmdAddRecord.Open MYSQL, DataConn, 1, 3
CmdAddRecord.AddNew
CmdAddRecord.Fields("site_id" = Request.Querystring("site"
CmdAddRecord.Fields("room_id" = Request.Querystring("room"
CmdAddRecord.Fields("book_date" = Request.Querystring("strDate"
CmdAddRecord.Fields("book_hour" = num
CmdAddRecord.Update
' closing objects and setting them to nothing
CmdAddRecord.Close
Set CmdAddRecord = Nothing
DataConn.Close
Set DataConn = Nothing
'Do the Loop
next
Response.Redirect "anypage.asp"
%>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.