%
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.
strName = objRs.Fields("Name")
strCity = objRs.Fields("City")
strTestimonial = objRs.Fields("Testimonial")
'Retrieving form input and assigning to a variable
'txtLastName is the name of the text box on the form
strName2 = Request.Form("txtName")
strCity2 = Request.Form ("txtCity")
strTestimonial2 = Request.Form("txtTestimonial")
'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 strName2 = "" or strCity2 = "" or strTestimonial2 = "" 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("Name") = strName2
objRs.Fields("City") = strCity2
objRs.Fields("Testimonial") = strTestimonial2
objRs.update
warningErrMsg = "Testimonial edited successfully"
end if
end if
%>
EDIT A TESTIMONIAL
Edit the testimonial below.
All fields are required.
| Message(s): <%= warningErrMsg %> |