문제

Where in the code would I place the response.redirect() code so that it would execute after a user selects the submit button to send their data? My goal is to redirect users after submission to a thank you page.

<!--#include file="db.asp" -->
<%
dim sql, intmid, strnameFirst, strnameMiddle, strnameLast, straddHome, strcityHome, strstateHome, strzipHome, strphoneHome, strfaxHome, stremailHome, strclassYear, stremployment, straddEmploy, straddEmploy2, strcityEmploy, strstateEmploy, strzipEmploy, strnumberEmploy, strfaxEmploy, stremailEmploy, strpositionEmploy, strmailPref, strexpertise, strserveBoard, strExplain, strextraInfo
dim str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11, str12, str13, str14, str15, str16, str17, str18, str19, str20, str21, str22, str23, str24
intmid = cint(request("memb_id")) 

if intmid <> "" and intmid <> "0" then
sql = "select * from members_table where memb_id=" & intmid
set rs = con.execute(sql)

strnameFirst        =   rs("memb_first_name")
strnameMiddle       =   rs("memb_mid_name")
strnameLast         =   rs("memb_last_name")
straddHome          =   rs("memb_home_add")
strcityHome         =   rs("memb_home_city")
strstateHome        =   rs("memb_home_state")
strzipHome          =   rs("memb_home_zip")
strphoneHome        =   rs("memb_home_phone")
strfaxHome          =   rs("memb_home_fax")
stremailHome        =   rs("memb_home_email")
strclassYear        =   rs("memb_grad_class")
stremployment       =   rs("memb_emp_plcae")
straddEmploy        =   rs("memb_emp_add")
straddEmploy2       =   rs("memb_emp_add2")
strcityEmploy       =   rs("memb_emp_city")
strstateEmploy      =   rs("memb_emp_state")
strzipEmploy        =   rs("memb_emp_zip")
strnumberEmploy     =   rs("memb_work_phone")
strfaxEmploy        =   rs("memb_work_fax")
stremailEmploy      =   rs("memb_work_email")
strpositionEmploy   =   rs("memb_position")
strmailPref         =   rs("memb_mail_pref")
strexpertise        =   rs("memb_area_expert")
strserveBoard       =   rs("memb_willing")
strExplain          =   rs("memb_area_other")
strextraInfo        =   rs("memb_add_info")


strexpertise = split(strexpertise,",")
for i = lbound(strexpertise) to ubound(strexpertise)
If strcomp(strexpertise(i),"Arts_and_Culture",1) = 0 Then
str1 = "checked"
End if
if strcomp(strexpertise(i),"Business",1) = 0 Then
str2= "checked"
End If
if strcomp(strexpertise(i),"Communications",1) = 0 Then
str3= "checked"
End If
if strcomp(strexpertise(i),"Education",1) = 0 Then
str4= "checked"
End If
if strcomp(strexpertise(i),"Government_Agency",1) = 0 Then
str5= "checked"
end If
if strcomp(strexpertise(i),"Health",1) = 0 Then
str6= "checked"
end if
if strcomp(strexpertise(i),"Human_Services",1) = 0 Then
str7= "checked"
end If
if strcomp(strexpertise(i),"Law",1) = 0 Then
str8= "checked"
end If 
if strcomp(strexpertise(i),"Non_Profit",1) = 0 Then
str9= "checked"
end if
if strcomp(strexpertise(i),"Profit",1) = 0 Then
str10= "checked"
end If
if strcomp(strexpertise(i),"Other",1) = 0 Then
str11= "checked"
end If
if strcomp(strexpertise(i),"Administration",1) = 0 Then
str12= "checked"
end If
if strcomp(strexpertise(i),"Banking",1) = 0 Then
str13= "checked"
end If
if strcomp(strexpertise(i),"Computers",1) = 0 Then
str14= "checked"
end If
if strcomp(strexpertise(i),"Finance",1) = 0 Then
str15= "checked"
end If
if strcomp(strexpertise(i),"Fundraising",1) = 0 Then
str16= "checked"
end If
if strcomp(strexpertise(i),"Grantwriting",1) = 0 Then
str17= "checked"
end If
if strcomp(strexpertise(i),"Management",1) = 0 Then
str18= "checked"
end If
if strcomp(strexpertise(i),"Marketing",1) = 0 Then
str19= "checked"
end if
if strcomp(strexpertise(i),"Program_Development",1) = 0 Then
str20= "checked"
end If
if strcomp(strexpertise(i),"Planning",1) = 0 Then
str21= "checked"
end If
if strcomp(strexpertise(i),"Public_Relations",1) = 0 Then
str22= "checked"
end If
if strcomp(strexpertise(i),"Policy_and_Procedurese",1) = 0 Then
str23= "checked"

end if
next

rs.close
set rs = nothing

end if


%>
도움이 되었습니까?

해결책

The traditional usage in my experience is:

  1. Form page- collect elements, submit form, seen by user
  2. Processing page- capture elements, do something liek adatabase insert, redirect to "thank you" type page, NOT seen by user'
  3. Thank you page, best personalized by elements from processing

So the answer is put the redirect on whatever page is accepting and processing the form inputs.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top