I'm a learning php this year but i encounters some problems.
One of them is about php value. The problem is how do i do to prevent a php file from resending the same values into the database whenever the page is refreshed?
You should redirect users when their post was successful, that way you avoid all such duplicate posts.
Using the post method, posting to a script which will either throw out an error, or redirect the user to the page they where viewing.
Hitting refresh won't repost their message since they where redirected, and hitting the back button will only bring them back to the same page, that is the page they where viewing and posting from.
You can do this redirect using the header function of PHP, it would of cause be a good idea to show a success message on the page you redirect them to, especially if you require some sort of validation of their post, otherwise they might think their post where lost and try to submit it again.
Not necessarily. Usually autoincrements is used on one of the columns in the database, this should avoid exact duplicates.
Extra checking for user errors that almost never occur, is just a waste of coding effort. It would be just as good to add a delete feature which is likely to be required anyway. :botles:
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Attention: "role based name" email prefixes such as support, webmaster, info, contact, forum, service, affiliate, admin, traffic, partners, marketing, etc., for our member accounts are not permitted. They are acceptable for a vendor listing, but not for the member email. This is due to bulk email processors scrubbing them for delivery due to extremely high bounce rates. Please apply for membership using a personalized email prefix. Something like bob@xxxxx.com.
If we discover you signed up with a role based name we will give you only one message to change it. After 3 days your account will be removed if the email is not changed.