View Full Version : Cookies & Forms
The Wizzard
07-18-2002, 06:47 AM
Hi, what i need to do is create a form for users to send information to me, but once they have submitted this form, they cannot submit the form again.
Thanks!:thumbsup:
allida77
07-18-2002, 01:48 PM
I dont think you need to use a cookie, javascript should be able to handle it
<script language='javascript'>
var submitted=0;
function validateForm()
{
if (submitted==0)
{
document.testForm.submit();
submitted=1;
}
}
</script>
The Wizzard
07-18-2002, 07:01 PM
Ya, but i dont want them to be able to re-submit EVER again... What this is, is an enlistment form for a game, and people will be able to send in there info and hope to be recruited, but i dont want someone spamming there info, or just crap info.
Thanks
allida77
07-18-2002, 08:04 PM
If you are wanting to set a cookie than if they delete cookies than they can submit the form. You can set a field into your db by capturing their IP or email. On your form page do something like:
for cookie:
whatever page the form action is sent to on the bottom put:
Response.Cookie("frmSubmitted") = "True"
on the top of your form page:
If Response.Cookie("frmSubmitted") = "True" Then
Response.Redirect "default.asp"
End If
Doing it like this they will always be redirected if their cookie is set. Using a db would be the same concept.
oracleguy
07-18-2002, 09:39 PM
Either of those ideas have pros and cons:
Cookies:
Pros-
Fast
Efficent
Cons-
If cookies are disabled, doesn't work.
IE6 have issues taking unsigned cookies
They can just be deleted
Database:
Pros-
Solves the problems cookies have
Much harder for people to resubmit
Cons-
Uses up server bandwidth and resources
If the person is on dial-up they're IP address resets when they re-connect.
I just thought I'd point that out. Perhaps some combination of the two?:)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.