%language="vbscript"
employerid="1"
' For each x in Request.Form
'Response.Write( x & " value = " & Request.Form(x) & "
" & vbNewLine)
'Next
Function ParseNum(strIn)
Dim vchar,tmpStr,strCtr
ParseNum = ""
tmpStr=Trim(strIn)
For strCtr = 1 To Len(tmpStr)
vchar=Mid(tmpStr,strCtr,1)
If InStr("1234567890.",vchar) > 0 Then
ParseNum = ParseNum + vchar
End If
Next
End Function
if request.form("save")=1 then
SET Conn = Server.CreateObject("ADODB.Connection")
Conn.open "formConn"
CommandLine = "Select count(*) from Employer where Employer.email='" & request.form("email") & "'"
Set Rstcount = Conn.Execute (CommandLine, RecordsAffected,adCmdText)
sendnews = 0
errormsg=""
notes=request.form("notes")
company=request.form("company")
username=request.form("username")
if len(trim(username)) < 1 then errormsg= errormsg & "User Name
"
password=request.form("password")
if len(trim(password)) < 1 then errormsg= errormsg & "Password
"
if len(trim(company)) < 2 then errormsg= errormsg & "Company
"
contact=request.form("contact")
if len(trim(contact)) < 2 then errormsg= errormsg & "Point of Contact
"
title=request.form("title")
addr=request.form("addr")
if len(trim(addr)) < 6 then errormsg= errormsg & "Address
"
addr2=request.form("addr2")
city=request.form("city")
if len(trim(city)) < 2 then errormsg= errormsg & "City
"
state=request.form("state")
if len(trim(state)) <> 2 then errormsg= errormsg & "State
"
zipcode=request.form("zipcode")
if len(trim(zipcode)) < 5 then errormsg= errormsg & "Zipcode
"
country=request.form("country")
if len(trim(country)) < 3 then errormsg= errormsg & "Country
"
phone=request.form("phone")
newphone=parsenum(phone)
if len(trim(newphone)) < 10 then errormsg= errormsg & "Phone Number with Area Code
"
if len(trim(newphone)) = 10 then
phone = "(" & mid(newphone,1,3) & ") " & mid(newphone,4,3) & "-" & mid(newphone,7,4)
end if
fax=request.form("fax")
newfax=parsenum(fax)
if len(trim(newfax)) < 10 then errormsg= errormsg & "Fax Number with Area Code
"
if len(trim(newfax)) = 10 then
fax = "(" & mid(newfax,1,3) & ") " & mid(newfax,4,3) & "-" & mid(newfax,7,4)
end if
email=request.form("email")
if len(trim(email)) < 9 or instr(email,"@")=0 or instr(email,".")=0 then errormsg= errormsg & "Complete Email Address
"
url=request.form("url")
if len(trim(url)) < 5 or instr(url,"http://")=0 or instr(url,".")=0 then errormsg= errormsg & "Include full URL including http
"
ext=request.form("ext")
if request.form("sendNews") <> "" then sendNews = 1
if errormsg > "" then errormsg = "Errors occurred: Please enter the following required fields to complete your registration:
" & errormsg & "
"
count = rstcount.fields(0)
if (count < 1) and errormsg = "" then ' avoid saving duplicates
commandline="Insert into employer (company,contact,title,addr,addr2,city,state,zipcode,phone,ext,fax,email,url,country,notes,SendNews,employerid,username,password,dateupdated)"
commandline=commandline & "values ('" & company & "','" & contact & "','" & title & "','" & addr & "','" & addr2 & "','" & city & "','" & state & "','" & zipcode & "','" & phone & "','" & ext & "','" & fax & "','" & email & "','" & url & "','" & country & "','" & notes & "','" & SendNews & "','" & employerid & "','" & username & "','" & password & "',#" & now() & "#)"
Conn.Execute commandline, RecordsAffected, adCmdText
end if
Conn.Close
Set Conn = Nothing
'This is where we define where we are sending the user when the application is completed successfully
if errormsg = "" then response.redirect "employer_resources.htm"
end if
%>
|
|||||||||||