![]() |
PUT requests not getting detected - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: PUT requests not getting detected (/showthread.php?tid=80679) |
PUT requests not getting detected - ancul - 11-30-2021 Routes.php PHP Code: $routes->put('admin/buku/change/(:num)', 'Admin\BookController::changeBook/$1'); Admin/BookController.php PHP Code: public function changeBook($id){ the form that calls the request PHP Code: <form class="border" action="<?= base_url('admin/buku/change/' . $bookData['book_id']) ?>" method="POST"> the form submission gives a 404 Error, but when i change the route method to POST, the route does get detected. I can't think of any explanation. The other projects i have doesn't have this issue so it shouldn't be related to my php installation or something RE: PUT requests not getting detected - kenjis - 11-30-2021 You set a PUT route, and send a request with POST method, and get 404. You set a POST route, and send a request with POST method, and get the page. It seems no problem. If you want to get PUT route, 1) send a request with PUT method, or 2) use HTTP Method Spoofing: https://codeigniter4.github.io/CodeIgniter4/incoming/methodspoofing.html RE: PUT requests not getting detected - ancul - 12-02-2021 the method spoofing solution worked. thanks! |