% if session("AccessLevel") <> "1" then
Response.Redirect "login.asp?Return=testimonials.asp"
end if %>
<%
Id = request("id")
' Create a recordset object to store specific table information
Set objRS = Server.CreateObject("ADODB.Recordset")
'Establish what records you want selected for the SQL query string
SQL = "Select * From TblTestimonials where Id =" & Id
'Set the recordset object equal to the SQL query string
objRS.Open SQL, objADO, 1, 3
'Retrieving database info.
strTitle = objRs.Fields("Title")
strBody = objRs.Fields("Body")
'Retrieving form input and assigning to a variable
'txtLastName is the name of the text box on the form
strTitle2 = Request.Form("txtTitle")
strBody2 = Request.Form("txtBody")
'This code only runs if the submit button is clicked
if Request.Form <> "" then
'Sets an error message if any required fields are left blank
if strTitle2 = "" or strBody2 = "" then
WarningErrMsg = "
All fields are required."
end if
'If error message was not set, then all error checks were passed; Connect to the database
if warningErrMsg = "" then
objRs.Fields("Title") = strTitle2
objRs.Fields("Body") = strBody2
objRs.update
warningErrMsg = "Editorial edited successfully"
end if
end if
%>
EDIT AN EDITORIAL
Edit the editorial below.
All fields are required.
| Message(s): <%= warningErrMsg %> |