In many cases, it is necessary to prevent the same form from being submitted multiple times, and many people's implementations are more complex (code counts more than dozens of lines!!) The following provides a way to use just a few lines of code, easily to prevent users from refreshing multiple submission forms and to repeat them multiple times with the back button.
Form file formtest.asp
<%randomize ' initial generation random number seed
Num1=rnd () ' produces random numbers NUM1
Num1=int (26*NUM1) +65 ' modifies NUM1 range so that it is a-Z-wide ASCII code to prevent table Single-name errors
Session ("antry") = "test" &CHR (NUM1) ' produces a random string
% >
< form name= "test" action= "testact.asp" method= "POST" >
Your name:< input type= ' text ' name= ' size=30 > ' note the Random form item name is used in the bank
< input type= ' submit ' value= ' submitted ' >
</form >
Form Handler testact.asp
<%
Teststr=request.form (Session ("Antry"))
If teststr= "" Then
Response.Write "did not fill in the name or repeat the submission"
' Cause the user did not fill in the name, or the form is repeated (the flag is null for session ("Antry"))
Else
Response.Write Teststr
Session ("antry") = "' Submit successfully, empty session (" Antry "), in case of repeated submission!!
End If
% >
In this case, you only need to randomize the form item name of a required item so that you do not have to randomize all the form items.
Welcome to my personal homepage http://swuse.yeah.net