Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Cookies & Forms

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Lake Forest, CA
    Posts
    259
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cookies & Forms

    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!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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>

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Lake Forest, CA
    Posts
    259
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Cincinnati, OH
    Posts
    545
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •