<%@ Language=VBScript %> <% option explicit %> User Details

  User Details Form


<% ' set flag to zero ' see if a session variable is set, if not check to see if user has a cookie ' if not, user will have to log in flag = request("flag") if flag = "" then flag = 0 end if ' now we're going to set up a CASE statement for the Flag ' so the script can do different things depending on flag value Select Case flag ' First time look shows the Add Form Case 0 Case 1 ' Update the database ' "myValidate" indicates if we need to use a regular expression, or if we are going to use ' some other form af validation. ' The following are the possible values that can be passed in the "myValidate" variable. ' (you can always add your own as well) ' regexp - If we use a regular expression, we also have an associated pattern defined ' by the 'PATTERN' attribute. The following are the possible "pre-determined" ' values that can be passed in the "myPattern" variable. ' phone_1 - phone number must match the pattern xxx-xxx-xxxx ' phone_2 - phone number must match the pattern (xxx)xxx-xxxx ' zip_1 - zip must match the pattern xxxxx ' zip_2 - zip must match the pattern xxxxx-xxxx ' You can also pass your own regular expression throught the "myPattern" variable ' email - Makes sure the email has no illegal characters and is in a valid format ' date - Makes sure the date is valid ' blank - Makes sure the field contains at least one character ' numeric - Makes sure the field contains a numeric value ' dropdown - Makes sure the field contains a numeric value 'validateField(myValue,myName,myValidate,myrequired,myPattern) firstname = request("firstname") firstname = checktext(firstname) lastname = request("lastname") lastname = checktext(lastname) hp = request("hp") hp = checktext(hp) wp = request("wp") wp = checktext(wp) email = request("email") email = checktext(email) company = request("company") company = checktext(company) address1 = request("address1") address1 = checktext(address1) address2 = request("address2") address2 = checktext(address2) city = request("city") city = checktext(city) state = request("state") state = checktext(state) zip = request("zip") zip = checktext(zip) ' firstname = validateField(request("firstname"),"First name","blank","Y","") ' if firstname then ' firstname = request("firstname") ' else ' msg = msg & strError ' end if ' lastname = validateField(request("lastname"),"Last name","blank","Y","") ' if lastname then ' lastname = request("lastname") ' else ' msg = msg & strError ' end if ' hp = validateField(request("hp"),"Primary phone","blank","Y","") ' if hp then ' hp = request("hp") ' else ' msg = msg & strError ' end if ' wp = validateField(request("wp"),"Alternate phone","regexp","N","") ' if wp then ' wp = request("wp") ' else ' msg = msg & strError ' end if ' email = validateField(request("email"),"Email","regexp","N","") ' if email then ' email = request("email") ' else ' msg = msg & strError ' end if ' company = validateField(request("company"),"Company","regexp","N","") ' if company then ' company = request("company") ' else ' msg = msg & strError ' end if ' ' address1 = validateField(request("address1"),"Address","regexp","N","") ' if address1 then ' address1 = request("address1") ' else ' msg = msg & strError ' end if ' address2 = validateField(request("address2"),"Address","regexp","N","") ' if address2 then ' address2 = request("address2") ' else ' msg = msg & strError ' end if ' city = validateField(request("city"),"City","blank","Y","") ' if city then ' city = request("city") ' else ' msg = msg & strError ' end if ' state = validateField(request("state"),"State","blank","Y","") ' if state then ' state = request("state") ' else ' msg = msg & strError ' end if ' zip = validateField(request("zip"),"Zip code","numeric","Y","") ' if zip then ' zip = request("zip") ' else ' msg = msg & strError ' end if uniqueid = AlmostUniqueID() insertentry = "(firstname, lastname, hp, wp, email, company, address1, address2, city, state, uniqueid, zip)" valueentry = "('" & firstname & "'," & _ "'" & lastname & "'," & _ "'" & hp & "'," & _ "'" & wp & "'," & _ "'" & email & "'," & _ "'" & company & "'," & _ "'" & address1 & "'," & _ "'" & address2 & "'," & _ "'" & city & "'," & _ "'" & state & "'," & _ "'" & uniqueid & "'," & _ "'" & zip & "');" if msg = "" then sqltext = "insert into tblhayuser " & insertentry & " values " & valueentry sqlnews.execute(sqltext) sqltext2 = "select hayuserid from tblhayuser where uniqueid = '" & uniqueid & "'" RSnews2.Open sqltext2, sqlnews2 hayuserid = RSnews2("hayuserid") RSnews2.close ltype = request("ltype") select case ltype Case 0 Case 1 response.Redirect("/haylist/haylisting/addhaylisting.asp?hayuserid=" & hayuserid & "") Case 2 response.Redirect("/haylist/pasturelisting/addpasturelisting.asp?hayuserid=" & hayuserid & "") Case 3 response.Redirect("/haylist/seedlisting/addseedlisting.asp?hayuserid=" & hayuserid & "") Case 4 response.Redirect("/haylist/serviceslisting/addserviceslisting.asp?hayuserid=" & hayuserid & "") Case 5 response.Redirect("/haylist/haylisting/addhaylistingNeed.asp?hayuserid=" & hayuserid & "") Case 6 response.Redirect("/haylist/pasturelisting/addpasturelistingNeed.asp?hayuserid=" & hayuserid & "") end select msg = "User type added at " & now() else msg = "Errors: No work done. " & msg end if ' response.Write sqltext End Select %> <% if msg <> "" then%>

<%=msg%>

<%end if%> Please provide the following information:
*Required fields

 

*First name: " tabindex="1" />    *Primary phone: " tabindex="8" />
*Last name: " tabindex="2" />    Alternate phone: " tabindex="9" />
Address Line 1: " tabindex="3" />    Email address: " tabindex="10" />
  Address Line 2: " tabindex="4" />    Company: " tabindex="11" />
*City: " tabindex="5" />         
*State: " tabindex="6" /> *Zip: " tabindex="7" />         

 

What type of listing do you want to add?

For products / services available: Hay Available Pasture Available Seed Available Services Available
For hay or pasture needed: Hay Needed Pasture Needed

 

 

<% call closedb %>