<% if request("action") = "add" then if request("subaction") = "" then'user is trying to complete blank form %>
 Staff Member's Name
 Phone Number
 Staff Member's Email

<% else 'ACTION=add and SUBACTION=complete SQL = "Insert into staff_tbl (staff_name , staff_phone, staff_email) Values ('" & cleanstring(request.form("iname")) &"','" & request("iphone") & "','" & request("iemail") & "');" SET CONN=server.createobject("ADODB.connection") Conn.open "DSN=nothingtoit_7051" SET COMM=server.createobject("ADODB.command") comm.activeconnection = CONN comm.commandtext = SQL comm.commandtype = adCmdText comm.execute conn.close set conn = nothing SET comm = nothing response.write "

You have successfully added a staff member to the database.

" end if' end of ADD action and ADD subaction else' request ACTION is = either modify or delete if request("subaction") = "complete" then if request("action") = "modify" then'now they have chose a specific record... if request("subsubaction") = "complete" then SQL = "UPDATE staff_tbl SET staff_name = '"&cleanString(request("iname")) &"', staff_phone='"&request("iphone") &"', staff_email='"&request("iemail") &"' WHERE staff_id="&request("id")&";" SET CONN=server.createobject("ADODB.connection") Conn.open "DSN=nothingtoit_7051" SET COMM=server.createobject("ADODB.command") comm.activeconnection = CONN comm.commandtext = SQL comm.commandtype = adCmdText comm.execute conn.close set conn = nothing SET comm = nothing response.write "

The staff member's information was successfully modified.

" else'they want a preloaded form to make changes on SQL = "SELECT * FROM staff_tbl WHERE staff_id="&request("id")&";" SET CONN=server.createObject("ADODB.connection") CONN.open "DSN=nothingtoit_7051" SET RS=server.CreateObject("ADODB.recordset") RS.Open SQL, CONN %>
"> Staff Member's Name
"> Phone Number
"> Staff Member's Email
">
<% rs.close set rs = nothing conn.close set conn=nothing end if'end of either modify preloaded form or modify run SQL else'subaction=COMPLTE and ACTION=DELETE SQL = "DELETE * FROM staff_tbl WHERE staff_id="&request("id")&";" SET CONN=server.createobject("ADODB.connection") Conn.open "DSN=nothingtoit_7051" SET COMM=server.createobject("ADODB.command") comm.activeconnection = CONN comm.commandtext = SQL comm.commandtype = adCmdText comm.execute conn.close set conn = nothing SET comm = nothing response.write "

The staff member was successfully deleted form the database.

" end if'end of modify or delte SQL else'SUBACTION is not yet complete, MOD and DEL share this common form... 'get a RS of all staff... 'make a table in a form with checkboxes for delete 'make a tags go to modify SQL... 'Make checkboxes plus submit delete record... SQL = "SELECT * FROM staff_tbl" SET CONN=server.createObject("ADODB.connection") CONN.open "DSN=nothingtoit_7051" SET RS=server.CreateObject("ADODB.recordset") RS.Open SQL, CONN, 2 rs.movefirst Response.write"" While NOT Rs.EOF id=rs("staff_id") response.write "" rs.movenext WEND response.write"
"&cleanHTMLstring(rs("staff_name"))&""&rs("staff_email")&""&rs("staff_phone")&"modifydelete
" rs.close set rs = nothing conn.close set conn=nothing end if'end of modify and delete sections end if'end of all options %>