caballeros
IS-IT--Management
Please look at the following code, I'm trying to present a grid type form when a user clicks on the checkbox and submits the form, the database should update only the returned field to yes.
Any help would be appreciated.
Thanks.
<%@LANGUAGE="VBScript"%>
<% Option Explicit
dim conn, rs,sCBTID, sName, sQuantaty,CBTID,var1, id,item, i, mysql
set conn = server.createobject("adodb.connection"
set rs = server.createobject("adodb.recordset"
conn.open "cbtData"
rs.open ("SELECT * FROM cbt", conn,2,2
'rs.filter =" CBTID = 16"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
while not rs.eof%>
<form method="post" name="test" action="t2.asp">
<table border="1" width="100%">
<tr>
<td width="33" bordercolor="Yellow"><input type="Checkbox" name="chk_<%=rs("CBTID"%>" value="<%=rs("CBTID"%>"></td>
<td width="33%" bordercolor="Yellow" ><%=rs("Name"%></td>
<td width="33%" bordercolor="Yellow"><%=rs("Quantaty"%></td>
<td width="34%" bgcolor="Purple"> </td>
</tr>
</table>
<%rs.movenext
wend
%>
</table>
<br>
<input type="submit" value="submit" name"b1">
</form>
<%
item = ""
for each item in request.form
'response.write(item)
if left(item,4) = "chk_" then
id = mid(item,5)
'build the sql line
mysql = "update cbt select (cbt.return = yes) from CbtData where id = CBTID"
conn.execute(mysql)
rs.requery
'response.write("the box checked" )
'response.write("<p>" &"the box u checked was "&"</p>" &item)
'response.write("<p>" &id)
end if
next
%>
</body>
</html>
Any help would be appreciated.
Thanks.
<%@LANGUAGE="VBScript"%>
<% Option Explicit
dim conn, rs,sCBTID, sName, sQuantaty,CBTID,var1, id,item, i, mysql
set conn = server.createobject("adodb.connection"
set rs = server.createobject("adodb.recordset"
conn.open "cbtData"
rs.open ("SELECT * FROM cbt", conn,2,2
'rs.filter =" CBTID = 16"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
while not rs.eof%>
<form method="post" name="test" action="t2.asp">
<table border="1" width="100%">
<tr>
<td width="33" bordercolor="Yellow"><input type="Checkbox" name="chk_<%=rs("CBTID"%>" value="<%=rs("CBTID"%>"></td>
<td width="33%" bordercolor="Yellow" ><%=rs("Name"%></td>
<td width="33%" bordercolor="Yellow"><%=rs("Quantaty"%></td>
<td width="34%" bgcolor="Purple"> </td>
</tr>
</table>
<%rs.movenext
wend
%>
</table>
<br>
<input type="submit" value="submit" name"b1">
</form>
<%
item = ""
for each item in request.form
'response.write(item)
if left(item,4) = "chk_" then
id = mid(item,5)
'build the sql line
mysql = "update cbt select (cbt.return = yes) from CbtData where id = CBTID"
conn.execute(mysql)
rs.requery
'response.write("the box checked" )
'response.write("<p>" &"the box u checked was "&"</p>" &item)
'response.write("<p>" &id)
end if
next
%>
</body>
</html>