I have a form that I use to put servers in what we call maintenance mode. It's just a (dynamic) list of servers that the user will toggle a checkbox to put the respective server in maintenance mode. I'm using the objid (serverid) as the checkbox value, checking for null, and if not, then set the maintenance mode. However, I'm not passing anything at all. Below is my form and ASP code:
Form Code:
Code:
<form action="updatemm_select.asp" method="get">
<table >
<td><input name="toggle_maint" type="checkbox" value="<% = objid %>">
</td>
</tr>
<%rsqdb.MoveNext%>
<%loop%>
<tr>
<td align=center colspan=6>
<input type="submit" value="Toggle Maint Mode" name="Maint">
</td>
</tr>
</table>
ASP Code (updatemm_select.asp)
Code:
<%
Dim serverid, conn, rsUpdate, machineid, status, rsqdbmmon, rsqdbmmoff, strquery, rs, toggle_maint, command, maint
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "'")
End Function
serverid = ChkString(Request.QueryString("serverid"))
machineid = ChkString(Request.QueryString("machineid"))
toggle_maint = ChkString(Request.QueryString("toggle_maint"))
maint = ChkString(Request.Form("maint"))
set Conn=Server.CreateObject("ADODB.Connection")
set rs = server.CreateObject("ADODB.Recordset")
Conn.open "Provider=sqloledb;Server=server;Initial Catalog=db;UID=user;PWD=pw;"
strQuery = "select name, status, objid from object where (objid like '" & Request.QueryString("objid") & "%') "
Set RS = conn.Execute( strQuery)
if request.querystring("objid") <> "" then
response.write ("ObjID: " )
response.write rs("objid")
end if