Welcome Guest, Not a member yet? Register   Sign In
Refreshing re-enters the data in the db again and again. Help?
#2

[eluser]boltsabre[/eluser]
When your registration form is (successfully) submitted, are you just loading a new view, or using redirect?

If you just load a new view, (I think, I'm at work so cannot test it) the global $_POST array is still populated with your form data and you're still in the same controller method. Thus if you hit refresh it will post the form again, and because it still has the $_POST data, it will successfully submit it.

Solution: after successfully submitting your form, use redirect() to redirect your user to another function and display the submit page from that function.

But....this tells also tells us you have a flaw in your logic somewhere, you should only every be able to create one account with the exact same information. After the form is submitted, I'd suggest you do a check against their email address (or something similar) and only run your DB insert if it is not already there. If it already exists, you should redirect them to a login page.


Messages In This Thread
Refreshing re-enters the data in the db again and again. Help? - by El Forum - 05-29-2012, 05:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB