John Davidson

php - No errors but getting a 404

0 comments
Message:


i'm developing a listing directory web application.


Here, i would like a user (Pre-set as revisor) to be able to approve or reject the ads posted from the guests.


I've done the following in the revisor dashboard :




<x-layout>
<div class="container">
<div class="row">
<div class="card" style="width: 18rem;">
<img src=" https://via.placeholder.com/150" class="card-img-top" alt="...">
<div class="card-body">
<h5 class="card-title">{{$ad->title}}</h5>
<p class="card-text">{{$ad->description}}</p>
<p class="card-text">{{$ad->category->name}}</p>
<p class="card-text">{{$ad->user->name}}</p>
<p class="card-text">{{$ad->created_at->format('d/m/Y')}}</p>
<p class="card-text">{{$ad->price}},00 €</p>
<a href="{{route('ad.detail' , compact('ad'))}}" class="btn btn-primary">Vai al dettaglio!</a>
<div class="d-flex justify-content-between mt-3">
<form action="post" action="{{route('revisor.accept', $ad->id)}}">
@csrf
<button type="submit" class="btn btn-success"><ion-icon name="checkmark-outline"></ion-icon></button>
</form>
<form action="post" action="{{route('revisor.reject', $ad->id)}}">
@csrf
<button type="submit" class="btn btn-danger"><ion-icon name="trash-outline"></ion-icon></button>
</form>
</div>
</div>
</div>
</div>
</div>

</x-layout>


My Answer:
It looks like you have a typo in your form action attribute. You have written "action" twice instead of "method" for the HTTP method.

Change this:




To this:




Do the same for the second form as well. This should fix the issue and allow the forms to submit the data correctly.

Rate this post

4 of 5 based on 9200 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us