Block GET Call to method - 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: Block GET Call to method (/showthread.php?tid=27559) |
Block GET Call to method - El Forum - 02-14-2010 [eluser]Ceros[/eluser] Hi, I know that in ASP.NET MVC there is something called AcceptVerbs. So you can do this: <AcceptVerbsOST>_ function insertdatabase(param1, param2)... Using this, when you directly call www.mysite.com/controller/insertdatabase it doesn't work. But it will if you are using a form with method="POST". Is there a way to do the same thing in CI? Thanks! Seb Block GET Call to method - El Forum - 02-14-2010 [eluser]brianw1975[/eluser] without further definition of "it doesn't work" my response is: eh....uh.... Code: if($this->input->post("submit")){ Block GET Call to method - El Forum - 02-14-2010 [eluser]Ceros[/eluser] [quote author="brianw1975" date="1266205864"]without further definition of "it doesn't work" my response is: eh....uh.... Code: if($this->input->post("submit")){ And this won't work if you are using jQuery and dialog. Block GET Call to method - El Forum - 02-14-2010 [eluser]Ceros[/eluser] Nevermind, I found this: $_SERVER['REQUEST_METHOD'] Return GET or POST so all you have to do is: Code: if($_SERVER['REQUEST_METHOD'] == "POST"){ Block GET Call to method - El Forum - 02-14-2010 [eluser]brianw1975[/eluser] [quote author="Ceros" date="1266210202"][quote author="brianw1975" date="1266205864"]without further definition of "it doesn't work" my response is: eh....uh.... Code: if($this->input->post("submit")){ And this won't work if you are using jQuery and dialog.[/quote] :-S seriously? you didn't think that that might be pertinent information in your OP? Block GET Call to method - El Forum - 02-15-2010 [eluser]Ceros[/eluser] Sorry, i was just searching for the equivalent of AcceptVerbs. I didn't think that jQuery would have change something. Anyway, you gave me a good hint so thank you. |