I have laravel blade view.
here is my html
<!-- Seven -->
<section >
<div >
<h2>Be my firend</h2>
<form method="post" action="{{route('GetInTouch')}}">
<div >
<div >
<label for="name">Name</label>
<input type="text" name="name" id="name" value="" />
</div>
<div >
<label for="email">Email</label>
<input type="email" name="email" id="email" value="" />
</div>
<div >
<label for="mobile">Mobile</label>
<input type="mobile" style="width: 100%" name="mobile" id="mobile" value="" />
</div>
<div >
<label for="message">Message</label>
<textarea name="message" id="message" rows="6"></textarea>
</div>
</div>
<ul >
<li><input type="submit" name="submit" id="submit" value="Send Message" /></li>
</ul>
</form>
</div>
</section>
I defined the route in web.php also in api.php
Route::post('/GetInTouch', function (Request $request) {
dd($request->all());
});
When viweing the page I get the error.
CodePudding user response:
You didn't name your route "GetInTouch".
Route::post('/GetInTouch', function (Request $request) {
dd($request->all());
})->name('GetInTouch');
https://laravel.com/docs/8.x/routing#named-routes
CodePudding user response:
Because route()
function's parameter is the name of the router, define your route like this.
Route::post('/GetInTouch', function (Request $request) {
dd($request->all());
})->name('GetInTouch');