Welcome Guest, Not a member yet? Register   Sign In
Routing method delete or get

Hello community,

I have a question regarding the routing when I want to delete a record from the database.

to delete the record I generate a link with the url (controller) and the id that I want to delete.

In this case I leave this example of how I do it.

$routes->get('deleteUs/(:any)', 'usx\usxController::deleteUs/$1', ['as' => 'deleteUsx');

or should I use


Should I use delete for security reasons?


CodeIgniter 4 User Guide:

While the add() method seems to be convenient, it is recommended to always use the HTTP-verb-based routes,
described above, as it is more secure. If you use the CSRF protection, it does not protect GET requests. If the URI
specified in the add() method is accessible by the GET method, the CSRF protection will not work.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Theme © iAndrew 2016 - Forum software by © MyBB