***** http://www.target1.com/survey/address.asp <% Msg="" 'Action = Left(UCase(Request("Action")),5) More = Request( "morequestions.x" ) Dim textvars() Dim textvals() ReDim textvars( 11 ) ReDim textvals( 11 ) textvars(0) = "firstname" textvars(1) = "mi" textvars(2) = "lastname" textvars(3) = "city" textvars(4) = "zip" textvars(5) = "email" ' These are not actually textvars, but they are included for completeness. textvars(6) = "state" textvars(7) = "home_address_line1" textvars(8) = "home_address_line2" textvars(9) = "sendoffers" textvars(10) = "sendemail" textvars(11) = "target1_id" 'validate email address If More = "" Then junk = 1 Else If InStr(Request("email"), "@") = 0 Then Msg = "You must enter an e-mail address in order to proceed!" Else Msg = "" End If End If 'validate text fields for empty data ' data can contain ' char 'This loop may be useful for some other validation, if required. 'If More <> "" AND Msg = "" Then ' For i = 0 To 5 ' var = Request( textvars(i) ) ' If var <> "" AND ( InStr( var, "'" ) <> 0 ) Then ' Msg = var & ": contains invalid characters" ' Exit For ' Else ' Msg = "" ' End If ' Next 'End If 'If inputs are proper Then load them into database. If ( More = "" ) Then junk = 1 ElseIf ( Msg = "" ) Then For i = 0 To 11 textvals(i) = "" Next Set Conn = Server.CreateObject("ADODB.Connection") Set RSADR = Server.CreateObject( "ADODB.RecordSet" ) Conn.Open Session("ConnectionString") sql = "select * from to_address where target1_id = " & CLng( Session( "target1_id" ) ) RSADR.Open sql, Conn, 1, 3 present = False Do While not RSADR.EOF present = True For i = 0 To 5 var = Request( textvars(i) ) If var = "" Then textvals(i) = RSADR( textvars(i) ) Else textvals(i) = var End If Next Exit Do LOOP If present = False Then For i = 0 To 5 textvals(i) = Request( textvars(i) ) Next End If For i = 6 to 10 textvals(i) = Request( textvars(i) ) Next textvals(11) = Session( "target1_id" ) 'RSADR.Open "to_address", Conn, 3, 3 If present = True Then 'update ReDim Preserve textvars(12) ReDim Preserve textvals(12) textvars(12) = "modify_date" textvals(12) = Now RSADR.Update textvars, textvals Else 'insert ReDim Preserve textvars(13) ReDim Preserve textvals(13) textvars(12) = "creation_date" textvars(13) = "modify_date" textvals(12) = Now textvals(13) = Now RSADR.AddNew RSADR.Update textvars, textvals End If RSADR.Close Conn.Close Response.Redirect( "/" & Session( "target1dir" ) & "/Questions.asp" ) End If site = Session( "site" ) target1dir = Session( "target1dir" ) %>
Target1 Feedback Survey

<%=Msg%>

<% If Session( "cookieid" ) = "DEMOPPID" Then If Request( "home_address_line1" ) = "" Then add1 = "1600 Pennsylvania Av" Else add1 = Request( "home_address_line1" ) End If If Request( "city" ) = "" Then city = "Washington D.C." Else city = Request( "city" ) End If If Request( "state" ) = "" Then state = "Washington" Else state = Request( "state" ) End If If Request( "zip" ) = "" Then zip = "20001" Else zip = Request( "zip" ) End If If Request( "email" ) = "" Then email = "demo@target1.com" Else email = Request( "email" ) End If End If %>
First Name: " size=30 maxlength=30>
Middle Initial: " size=1 maxlength=1
Last Name: " size=30 maxlength=30
Home Address (line 1):
Home Address (line 2): " size=30 maxlength=30>
City:
State:
Zip:
<% If Msg = "" Then %> What is your e-mail address: <% Else %> What is your e-mail address: <%End If %>
Please E-mail offers that might be of interest to me when they are available
Please forward direct mail offers that might be of interest to me when they are available