T
T
Twelfth Doctor2017-07-05 14:57:51
Laravel
Twelfth Doctor, 2017-07-05 14:57:51

Why doesn't the CSRF token match?

Hello! For some reason, when submitting a form in a Laravel application, I get a TokenMismatchException. How to solve this problem?
Here is the view with the form itself

@extends('layouts.app')

@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-8 col-md-offset-2">
                <div class="panel panel-default">
                    <div class="panel-heading">Добавление домена</div>

                    <div class="panel-body">
                        <form method = "POST">
                            {{ csrf_field() }}
                            <label>
                                Имя домена
                                <input name = "content">
                            </label>

                            <br>
                            <input type = "submit" value = "Add">
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

UPD. There really is no token in the HTML code
<form method="POST"><label>
                                Имя домена
                                <input name="content"></label> <br> <input type="submit" value="Add"></form>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Semyon Beloglazov, 2017-07-05
@Batlab

<input type="hidden" name="_Token" value="{{ csrf_token() }}">

Try this

G
GrimJack, 2017-07-05
@GrimJack

Try to write more inside as a meta field
Now there is no way to find it, google it, this often came up

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question