i am buliding a website as my mini project.
problem: when i submit registration form, if the username or email or even both already exist, I have writen the code to check if either of them exist in the database.. and that is working great..
and if the user still submits the form, i redirect the page to some other page where i notify the user for error.. It works great, i show up a div using jquery which displays error on top of everything on the page..

however on refresh, i would again, notify for submitting the form, and if i click on yes, it would display the same information..
i need a mechanism, where i could atleast stop submitting the form on refresh ..
i tried redirecting from servlet instead of request dispatcher, but that would create more flaws in my code,..
please suggest a solution!!!
thank you

he best plan is to do a header redirect after the form is processed.


header('Location: http://www.example.com/');
Even if you redirect to the same url, refreshing won't resubmit the form

please mark this as solved,if you get your answer and your doubts are solved.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.