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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    limited submission of a form

    hi, I originally posted this in the javascript forum, but it turns out this is the best place to ask.

    How would I limit the total number if subscribers to a newsletter. The form wouldhave to redirect them to a newpage explaining that my limit of 50 has been reached and that I wasn't sent their information.

    Before that imit is reached, the data from the form they fill out (html of course) would be emailed to me. I am very new to php and I am still lfiguring it out. I would appreciate any input Thanks

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    One easy way is to store the number of subscribers in a flat file. Or, store the email and name of each subscriber in a flat file, then you can simply count the number of subscribers to determine if the currently submitted form should be rejected. Or if you want to go to another level you can create a database (MySQL for example) to store the information, but that's yet another learning curve. (I suggest one learning curve at a time)

    Here is your homework:

    How to open a new file for writing or reading: fopen() (study the different modes you use to open files)

    How to write a line to an open file: fwrite()

    Easy way to count the number of records in a file: Use file() to build an array from a file's contents, then use count() to count the number of records in that array


  •  

    Posting Permissions

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