Data is inserting Repeatedely when i click refresh. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Data is inserting Repeatedely when i click refresh. (/showthread.php?tid=18191) |
Data is inserting Repeatedely when i click refresh. - El Forum - 04-28-2009 [eluser]Dinesh Viswanath[/eluser] Hello All, I'm new to CI, But learning as quick as possible. Now, I'm developing an News Board Application. In this i'll add news & update it. Code: class NewsController extends Controller { For adding News, My URL will looks like - <b>http://localhost/index.php/newcontroller/addnews</b>. After successfully adding Data to the Database I’m calling the Index () function. But URL is remaining same as <b>http://localhost/index.php/newcontroller/addnews. <br>Once when i Press "REFRESH" Button Data is Repeatedly Inserting into database. I wanted to have U</b>RL looks like <b>http://localhost/index.php/newscontroller</b> So that Data won’t be inserted with out necessary. Pls tell some way to control this Refresh problem. Data is inserting Repeatedely when i click refresh. - El Forum - 04-28-2009 [eluser]cideveloper[/eluser] Instead of using Code: self::index(); why dont you use Code: redirect('/newscontroller/', 'refresh'); as long as nothing is being written to the browser this will work. See the link below http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html Data is inserting Repeatedely when i click refresh. - El Forum - 04-28-2009 [eluser]Thorpe Obazee[/eluser] You could use sessions to 'remember' that the same user(or anything) has inserted data then prevent it. Data is inserting Repeatedely when i click refresh. - El Forum - 04-28-2009 [eluser]slowgary[/eluser] Why not just stop clicking refresh? ;-) Data is inserting Repeatedely when i click refresh. - El Forum - 04-28-2009 [eluser]Thorpe Obazee[/eluser] [quote author="slowgary" date="1240991746"]Why not just stop clicking refresh? ;-)[/quote] Prevention is better than cure? Data is inserting Repeatedely when i click refresh. - El Forum - 04-28-2009 [eluser]Dinesh Viswanath[/eluser] A perfect Design should forgive even when user commits mistake unknowingly. @bargainph well said... Data is inserting Repeatedely when i click refresh. - El Forum - 04-29-2009 [eluser]Zeeshan Rasool[/eluser] Please read this Redirection Problem |