• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data is inserting Repeatedely when i click refresh.

[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.

class NewsController extends Controller {
    function NewsController()
    function index()
function addnews()

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.

Instead of using


why dont you use

redirect('/newscontroller/', 'refresh');

as long as nothing is being written to the browser this will work. See the link below


[eluser]Thorpe Obazee[/eluser]
You could use sessions to 'remember' that the same user(or anything) has inserted data then prevent it.

Why not just stop clicking refresh? ;-)

[eluser]Thorpe Obazee[/eluser]
[quote author="slowgary" date="1240991746"]Why not just stop clicking refresh? ;-)[/quote]

Prevention is better than cure? Smile

[eluser]Dinesh Viswanath[/eluser]
A perfect Design should forgive even when user commits mistake unknowingly. @bargainph well said...

[eluser]Zeeshan Rasool[/eluser]
Please read this

Redirection Problem

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.