i have an update form to update the product details :
<form action="{{ path_for('product.update', {id: product.id}) }}" method="get">
// another fields
<input type="hidden" name="_METHOD" value="PUT">
<input type="submit" name="submit" class="submit" value="update">
routes :
$app->get('/admin/product/edit/{id}', ['maimana\Controllers\AdminController','editupdateProduct'])->setName('product.edit');
$app->get('/admin/product/update/product/{id}', ['maimana\Controllers\AdminController','updateProduct'])->setName('product.update');
and the controller :
public function updateProduct($id, Request $request, Response $response){
$product = $this->product->where('id',$id)->first()->update([
'title' => $request->getParam('title'),
'category' => $request->getParam('category'),
'slug' => $request->getParam('slug'),
'description' => $request->getParam('description'),
'price' => $request->getParam('price'),
'image' => $request->getParam('image'),
'stock' => $request->getParam('stock')
]);
return $response->withRedirect($this->router->pathFor('admin.product'));
}
everytime i hit the update button, i cant pass the parameter is automatically and it turns PAGE NOT FOUND. but when i add the id manually it works and redirect back to admin.product.
please help me im getting stuck for about 4 days and i need this for my college task