Answer the question
In order to leave comments, you need to log in
Why is the hidden token not generated?
I'm using version 5.2
When submitting the form, a hidden field should be generated.
Tried to prescribe in different versions:
<input class="input-btn" type="hidden" name="_token" value=" {{ csrf_token() }}">
{{ csrf_field() }}
$('form').append('{{csrf_field()}}');
<div class="col-lg-8 wow fadeInLeft delay-06s">
<div class="form">
<form action="{{ route('home')}}" method="post">
<input class="input-text" type="text" name="name" value="Your Name *" onFocus="if(this.value==this.defaultValue)this.value='';" onBlur="if(this.value=='')this.value=this.defaultValue;">
<input class="input-text" type="text" name="email" value="Your E-mail *" onFocus="if(this.value==this.defaultValue)this.value='';" onBlur="if(this.value=='')this.value=this.defaultValue;">
<textarea name="text" class="input-text text-area" cols="0" rows="0" onFocus="if(this.value==this.defaultValue)this.value='';" onBlur="if(this.value=='')this.value=this.defaultValue;">Your Message *</textarea>
<input class="input-btn" type="submit" value="send message">
<!-- <input class="input-btn" type="hidden" name="_token" value=" {{ csrf_token() }}">-->
{{ csrf_field() }}
</form>
</div>
Route::group(['middleware'=>'web'],function() {
Route::match(['get','post'],'/',['uses'=>'[email protected]','as'=>'home']);
Route::get('/page/{alias}',['uses'=>'[email protected]','as'=>'page']);
Route::auth();
});
Answer the question
In order to leave comments, you need to log in
Why are you commenting on this field? {{ csrf_field() }} implies that this field is hidden, and if you comment on it, the system will ignore it, so it won't be generated
. Anyway, just put this @csrf or {{ csrf_field() }} directive after the forms, and do not insert into any input
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question