%
Response.Expires = 0
Response.Buffer = True
'Retrieving form input and assigning to a variable
if session("AccessLevel") = "1" then
strLastName = Request.Form ("txtLastName")
strFirstName = Request.Form("txtFirstName")
strAgencyName = Request.Form("txtAgencyName")
strAddress = Request.Form("txtAddress")
strCity = Request.Form("txtCity")
strState = Request.Form("State")
strZip = Request.Form("txtZip")
strCountry = Request.Form("Country")
strPhoneNumber = Request.Form("txtPhoneNumber")
strFaxNumber = Request.Form("txtFaxNumber")
strEmailAddress = Request.Form("txtEmailAddress")
strSubscriptions = request("radSubscriptions")
strDescription = request("txtDescription")
strWebsite = Request.Form("txtWebsite")
strPager = Request.Form("txtPager")
strCell = Request.Form("txtCell")
strUploadPic = Request.Form("radUploadPic")
end if
if session("AccessLevel") = "4" or session("AccessLevel") = "8" then
strUserName = session("UserName")
' Create a recordset object to store specific table information
Set objLogin = Server.CreateObject("ADODB.Recordset")
'Establish what records you want selected for the SQL query string
SQL = "Select * From TblLogin where (UserName = '" + strUserName + "')"
'Set the recordset object equal to the SQL query string
objLogin.Open SQL, objADO, 1, 3
strLastName = objLogin("LastName")
strFirstName = objLogin("FirstName")
strAgencyName = objLogin("AgencyName")
strAddress = objLogin("Address")
strCity = objLogin("City")
strState = objLogin("State")
strZip = objLogin("Zip")
strCountry = objLogin("Country")
strPhoneNumber = objLogin("PhoneNumber")
strFaxNumber = objLogin("FaxNumber")
strEmailAddress = objLogin("EmailAddress")
strDescription = objLogin("AgentDescription")
strWebsite = objLogin("Website")
strPager = objLogin("Pager")
strCell = objLogin("CellPhone")
strPicture1 = objLogin("Picture1")
end if
strServiceCat = Request.Form("cboServiceCat")
'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 strLastName = "" or strFirstName = "" or strAgencyName = "" or strAddress = "" or strcity = "" or strState = "" or strZip = "" or strCountry = "" or strPhoneNumber = "" or strEmailAddress = "" then
WarningErrMsg = "
All fields marked with an * are required."
end if
if strPhoneNumber <> "" and not isnumeric(strPhoneNumber) then
warningErrMsg = WarningErrMsg + "
Phone # can only contain numbers."
end if
if strPhoneNumber <> "" and len(strPhoneNumber)<> "10" then
warningErrMsg = WarningErrMsg + "
Phone # must contain 10 digits. Please include the area Code."
end if
if not isnumeric(strFaxNumber) and strFaxNumber <> "" then
warningErrMsg = WarningErrMsg + "
Fax # can only contain numbers."
end if
if strFaxNumber <> "" and len(strFaxNumber)<> "10" then
warningErrMsg = WarningErrMsg + "
Fax # must contain 10 digits. Please include the area Code."
end if
'Checks for a valid email address
if strEmailAddress <> "" and (instr( strEmailAddress, "@") = 0 or instr( strEmailAddress, ".") = 0) then
WarningErrMsg = WarningErrMsg + "
Email Address must be in the form account@server.com."
end if
'If error message was not set, then all error checks were passed; Connect to the database
if warningErrMsg = "" then
strFullName = strFirstName + " " + strLastName
' 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
if objRS.EOF then
objRs.addnew
objRs.Fields("LastName") = strLastName
objRs.Fields("FirstName") = strFirstName
objRs.Fields("AgencyName") = strAgencyName
objRs.Fields("Website") = strWebsite
objRs.Fields("Pager") = strPager
objRs.Fields("CellPhone") = strCell
objRs.Fields("AgentDescription") = strDescription
objRs.Fields("Address") = strAddress
objRs.Fields("City") = strCity
objRs.Fields("State") = strState
objRs.Fields("Zip") = strZip
objRs.Fields("Country") = strCountry
objRs.Fields("PhoneNumber") = strPhoneNumber
objRs.Fields("FaxNumber") = strFaxNumber
objRs.Fields("EmailAddress") = strEmailAddress
objRs.Fields("UserName") = strUserName2
objRs.Fields("Password") = strPassword
objRs.Fields("Category") = strServiceCat
objRs.Fields("Picture1") = strPicture1
objRs.Fields("ReceiveMailings") = strSubscriptions
objrs("Expires") = dateadd("m", 12, date())
objRs.update
end if
end if
end if
%>
ADD COMPANY TO THE SERVICE DIRECTORY
Fill in the required information below.
Fields marked with an * are required.
| Error(s):<%= warningErrMsg %> |