We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,322 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

stop form submission

hi,
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

2
Contributors
2
Replies
2 Weeks
Discussion Span
6 Months Ago
Last Updated
3
Views
irshsheikh
Newbie Poster
1 post since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

e.g.

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

jalpesh_007
Posting Whiz
336 posts since Sep 2010
Reputation Points: 4
Solved Threads: 36
Skill Endorsements: 4

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

Thanks

jalpesh_007
Posting Whiz
336 posts since Sep 2010
Reputation Points: 4
Solved Threads: 36
Skill Endorsements: 4

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0586 seconds using 2.66MB