Home » Php » html – PHP – Button type submit does nothing when clicked

html – PHP – Button type submit does nothing when clicked

Posted by: admin February 25, 2020 Leave a comment


I am working in a form with two separated divs and When I click the Button in the bottom of the form it should redirect me to a new page but as of now it does nothing.

I already tried few things that might fix it like:

  1. Changing the button type to input type
  2. Fixing the route for form
  3. Chaging the action property of form tag into the function name from the controller

Here’s my current progress (Picture of web page where the form is placed):

Div 1
Div 2

And here’s my source code for the view (SelectFlight.blade.php):

Here’s my line of code on web.php which is responsible for routing/redirecting to a new page when Submit button was clicked:

Finally the snippet source code of a function inside my controller (BookController.php):

**Question: **

Why does the form does nothing when I clicked it? and how can I fix it in order to redirect a user to register page when the submit button is clicked?

How to&Answers:

Here is a similar post. It discusses forms with Get methods and actions, that may be your issue. The other solution would be to change this to a JavaScript method by adding a function to your form like this. However, keep in mind this post is for submitting forms and not resetting the page


As @Curstis suggested. You have several form tags scattered around this page. Now, I have removed them for you and just left the first and last form tags. So try the following code instead and the form should submit now. Always ensure your submit button is WELL bound like this: < form >…< button> … < / button> < / form >. for it to work.