jeudi 23 mai 2019

Page with multiple Form not redirecting

Good day, all. I have a blade file with 4 forms. The fourth one is used to redirect to another page. However, after setting up the routes and URL, when I hit the 'Next' button (on form four) it just refreshes the same page instead of going to the page specified in action on the form. I'll post blade file snippet and routes below.

I've tried using URL('myURL') method and Route('myNamedRoute') but nothing works.

Blade file with forms (3 like this):

    <form id="ref-form-3" action="" method="POST">
      <input type="text" name="first_name" class="form-control"required>
       <input type="text" name="last_name" class="form-control"required>
       <input type="text" name="mobile" class="form-control"required>
       <input type="email" name="email" class="form-control"required>
   <input type="submit" class="btn btn-secondary" name="" value="Send" />
  </form>

//fourth form

   <form id="testform" action="" method="POST">
    <button type="submit" class="btn btn-primary"id="testbtn">Next</button>
   </form>

//Route file in web.php

  Route::post('/ref3', 'Dir\SomeController@ref3');
  Route::post('/next', 'Dir\SomeController@nextPg');

//Function in controller

    public function ref3(Request $request){
          echo 'eubmitted';
      }

     public function nextPg(Request $request){
          echo 'next clicked';
      }

I expect that when I click the submit button on any of the forms the action URL will be used. Instead, the page only refreshes and stays.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire