% msgadd = false action = UCase(left(Request.Form("action"),3)) Select Case action Case "SUB" strHPhone = chkphone(Request.Form("hphone")) strWPhone = chkphone(Request.Form("wphone")) strFax = chkphone(Request.Form("fax")) ' strUname = left(Request.Form("fname"),1)&trim(Request.Form("lname")) sql = "insert into tblCouncilMember (fname, lname, mi, occupation, addr, city, state, zipcode, hphone, wphone, fax, email, prevexperience, humanexperience, q1, q2, q3, q4, q5, q6, entrydate) VALUES ('"_ & replace(Request.form("fname"),"'","''") & "','" _ & replace(Request.form("lname"),"'","''") & "','" _ & Ucase(replace(Request.form("mi"),"'","''")) & "','" _ & replace(Request.form("title"),"'","''") & "','" _ & replace(Request.form("addr"),"'","''") & "','" _ & replace(Request.form("city"),"'","''") & "','" _ & request.form("state") & "','" _ & request.form("zipcode") & "','" _ & strHPhone & "','" _ & strWPhone & "','" _ & strFax & "','" _ & request.form("email") & "','" _ & replace(Request.form("prevdesc"),"'","''") & "','" _ & replace(Request.form("humandesc"),"'","''") & "','" _ & request.form("q1") & "','" _ & request.form("q2") & "','" _ & request.form("q3") & "','" _ & request.form("q4") & "','" _ & request.form("q5") & "','" _ & request.form("q6") & "','" _ & date() & "')" Conn.Execute(sql) if err = 0 then msgadd = true set rs = Conn.Execute("select max(id) from tblCouncilMember") id = rs(0) rs.close Response.Redirect("../pages/printjobtc.asp?id="&id) else Response.Write err.Description end if End Select function chkphone(strPhone) if strPhone <> "" then if instr(strPhone, "-") or instr(strPhone, ")") or instr(strPhone, "(") or instr(strPhone, " ") or instr(strPhone, ".") then strPhone = replace(strPhone, "-", "") strPhone = replace(strPhone, ")", "") strPhone = replace(strPhone, "(", "") strPhone = replace(strPhone, " ", "") strPhone = replace(strPhone, ".", "") end if if len(strPhone) <> 10 AND len(strPhone) <> 7 then chkPhone = 1 end if for i = 1 to len(strPhone) if not isnumeric(mid(strPhone, i, 1)) then chkPhone = 1 end if next else chkPhone = 0 end if if chkPhone <> 1 then chkPhone = strPhone end if end function %>