I have a form that needs 10 inputs from a user.. Now my problem is, once the user have input the 10 needed information, he/she cannot input another information and there will be a message stating that he/she cannot input the information because past information have inputed.

What do I need to add to check if the user have input 10 information and can no longer input after that one..

Thanks.. :D

7 Years
Discussion Span
Last Post by ms.rhea

Do you mean that the user cannot submit your form more than 10 times? You could store a cookie with a count, or you could make a database table for it (ip, count), but in both ways the user may still submit the form, on another browser or from another ip.


As twiss mentions, it depends on your data storage and data input methods.

For a single input form submission, you want to limit this to 10. Cookies can be used as long as coolies are enabled. However, if a user clears his/her cookies, they have another 10 goes.

A safer option is to poll the DB before allowing more writes. IP logging, as mentioned is not foolproof. Some users may have a shared IP or users can change their IP.

You don't need a dedicated count column, you can query the DB and do a COUNT(). THis means that the user should be logged in though. If you're not using user login, you'll probably need to rely on the methods already mentioned.


Yes, you could also just count() stuff, if you put every submit in a seperate row. It's slower, though, but you probably shouldn't worry about that.


Thank you for helping me.. I'll do your suggestions.. :D

Edited by ms.rhea: wrong grammar

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.