![]() |
How Can I Destroy User Data After Insertion ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: How Can I Destroy User Data After Insertion ? (/showthread.php?tid=10256) Pages:
1
2
|
How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]Zeeshan Rasool[/eluser] Hi all, here is a problem im facing. Problem is , when i create a new user and click submit button the CREATE_USER_DB function executes and new user has been inserted. But when i refresh the page by pressing F5 or else an other user data is inserted in DB with same record values How can i destroy userdata or $_POST data so it can be stopped? Very Thnx in Advance. How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]sanct_arvin[/eluser] redirect it to another page. Code: $query = $this->db->insert('users', $_POST); create a redirection page in your prompt.php Code: <html> i use it every time i don't want a duplicate data ![]() you can use it in every pages that would insert data. kudos! regards - sanct_arvin How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]Sumon[/eluser] You can also use Code: foreach($_POST as $Key => $Value) Hope it helps you How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]Grahack[/eluser] Strange, I thought that this F5 thing was browser related. No matter what happens server-side, our browsers often remember what they "posted", so resetting the $_POST array seems to me useless. How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]Sumon[/eluser] Ops... sorry for my post. You are right. It's completely browser dependent. So it might better to redirect into another function(). How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]Zeeshan Rasool[/eluser] Thnx yaar! so what shud me do now? How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]sanct_arvin[/eluser] redirect it to another page after your insert use redirect() function How Can I Destroy User Data After Insertion ? - El Forum - 07-24-2008 [eluser]Zeeshan Rasool[/eluser] Got it ! thank you all How Can I Destroy User Data After Insertion ? - El Forum - 07-25-2008 [eluser]Colin Williams[/eluser] It is generally good practice to redirect "successful" form posts (though doing a meta redirect from HTML is not the best thing, when you can just initiate a new HTTP request from PHP), and use Session variables to pass along information, like messages, or even original $_POST data. Some frameworks do this.... has me thinking... Gah! So many good ideas for CI libraries! How Can I Destroy User Data After Insertion ? - El Forum - 02-08-2009 [eluser]gh0st[/eluser] The way I used to do it was; Form -> processSomething.php -> Result I call it a "processing file" and it does the work and redirects once its finished so that if the user press back or press F5 it won't cache the result. Although you still need to do checks to ensure that the data in processSomething.php is valid and accurate (perhaps delaying how many times someone can press `submit` on a form, etc) you can stop this issue. But I'm not sure whether using a redirect as shown above is firstly MVC, and secondly correct. Thanks |