Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Data is inserted twice after a page refersh

Hi guys,

I have a problem about data insertion in my database table. when i refresh my page after form submit it duplicates the first one. Is there any way to prevent this without comparing the data if it is present already in the database or by not redirecting the user to other page. What i want is the user will stay on same page.

Thanks



5.9k

check your browser plugin, my chrome alse experienced same problem but firefox run fine



30.2k
Accepted
answer

$this->response->redirect('controller/action');

saves my day :)

Have you tried setting database table columns as Unique

@Dominic Kinyanjui i havent yet, is setting table column to unique will prevent this kind of issue?

@Dominic Kinyanjui i havent yet, is setting table column to unique will prevent this kind of issue?

This will work but only if your column fields will not be null