javascript - form not being submitted laravel

375

I am building a basic form in laravel 5.4.22 but it is not being submitted, when i click on submit it stays on the same page just changing the url to something different I used this Route

    Route::post('/contact/submit', '[email protected]');

This is the controller i made use of

   `<?php

      namespace App\Http\Controllers;

       use Illuminate\Http\Request;

       class MessagesController extends Controller
    {
        public function submit(Request $request){
         this->validate($request, [
              'name' => 'required',
              'email' =>'required'
               ]);
                 return 'SUCCESS';
                    }
                   }; ` 

& here is my contact form

            @extends('layouts.app')

             @section('content')
            <H1>Contact</H1>
{!! Form::open(['action'=>'[email protected]','method'=>'post']) !!}
     <div >
      {{Form::label('name', 'Name')}}
      {{Form::text('name', '', ['class' => 'awesome form-control', 'placeholder' => 'Enter name'] )}}
       </div>
     <div >
      {{Form::label('email', 'E-Mail Address')}}
    {{Form::text('email', '', ['class' => 'awesome form-control', 'placeholder' => 'Enter Email id'])}}
     </div>
    <div >
     {{Form::label('messages', 'Message')}}
    {{Form::textarea('message', '', ['class' => 'form-control', 'placeholder' => 'Enter your message here'])}}
    </div>
     <div>
    {{Form::submit('Submit', ['class'=> 'btn btn-primary'])}}
     </div>
    {!! Form::close() !!}
   @endsection

,This is the main page where i connect the other things

   <!DOCTYPE html>
  <html>
  <head>
   <title>Dradz</title>
   <link rel="stylesheet" type="text/css" href="/css/app.css">
  </head>
  <body>

  @include('inc.navbar') 
  <div >
   @if(Request::is('/'))
   @include('inc.showcase')
   @endif
   <div >
    <div >
    @include('inc.messages')
   @yield('content')
  </div>
    <div >
      @include('inc.sidebar')
      @show
     </div>
  </div>
  </div>
 <footer id="footer" >
    <p>Copyright 2017 &copy; Dradz</p>
    </footer>
   </body>
     </html>  

People are also looking for solutions to the problem: php - Related Product text is too high under product in WooCommerce?

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.