skip to Main Content

I am getting this error on form submission:
The POST method is not supported for this route. Supported methods: GET, HEAD.
Here is the form code:

<form action="bid" method = "POST" >
    @csrf
    <h2>
        Your Bid
    </h2>
    <h4 style="font-size:15px;color:antiquewhite">Days</h4>
                                    <input type="number" name="days" placeholder=" Your Days to complete project" class="form-input"><br />
                                    <h4 style="font-size:15px;color:antiquewhite">Cost</h4>
                                    <input type="number" name="cost" placeholder="Your bid cost in $ doller" class="form-input"><br />
                                    <button class="btnn-U" type="submit">Send</button>

</form>

and here is the Route code:

Route::post('bid','AppHttpControllersregister@bid');

I have tried using php artisan route:cache

2

Answers


  1. The first thing, a recommendation, write your routes like this and give your route any name;

    Route::post('bid','AppHttpControllersregister@bid');
    
    to
    
    Route::post('bid',[AppHttpControllersregister::class, 'bid'])->name('uniqueRouteName');
    

    And call this route with name;

    <form action="{{ route('uniqueRouteName') }}" method = "POST" >
            @csrf
            <h2>
                Your Bid
            </h2>
            <h4 style="font-size:15px;color:antiquewhite">Days</h4>
            <input type="number" name="days" placeholder=" Your Days to complete project" class="form-input"><br />
            <h4 style="font-size:15px;color:antiquewhite">Cost</h4>
            <input type="number" name="cost" placeholder="Your bid cost in $ doller" class="form-input"><br />
            <button class="btnn-U" type="submit">Send</button>
    </form>
    
    Login or Signup to reply.
  2. <form action="/bid" method = "POST" >
    Tried different things but ultimately this solved my problem.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search