%
Response.Expires = 0
Response.Buffer = True
'Retrieving form input and assigning to a variable
'txtLastName is the name of the text box on the form
strServiceCat = Request.Form("cboServiceCat")
strDescription = Request.Form("txtDescription")
strCompany = Request.Form("txtCompany")
strWebsite = Request.Form("txtWebsite")
strCity = Request.Form("txtCity")
strState = Request.Form("cboState")
'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 strServiceCat = "" or strDescription = "" or strCompany = ""then
WarningErrMsg = "
All fields marked with an * are required."
end if
'If error message was not set, then all error checks were passed; Connect to the database
if warningErrMsg = "" then
' 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 TblServices"
'Set the recordset object equal to the SQL query string
objRS.Open SQL, objADO, 1, 3
objRs.addnew
objRs.Fields("Company") = strCompany
objRs.Fields("Website") = strWebsite
objRs.Fields("Category") = strServiceCat
objRs.Fields("City") = strCity
objRs.Fields("State") = strState
objRs.Fields("Description") = strDescription
objRs.Fields("UserName") = session("UserName")
objrs.Fields("Date") = date()
objrs("Expires") = dateadd("m", 6, date())
objRs.update
'else redirect to success page and send registration email
response.redirect "servicesuccess.asp?cat=" & objRs("Category")
end if
end if
%>
ADD SERVICE TO DIRECTORY
Fill in the required information below to add a service to the directory.
Fields marked with an * are required.
| Error(s):<%= warningErrMsg %> |