A
A
Adik Izat2019-05-18 21:35:34
Laravel
Adik Izat, 2019-05-18 21:35:34

How to solve form error in Laravel?

I have a form:

@extends('layouts.app')

@section('content')
    <div class="jumbotron text-center">
        <h1>{{$title}}</h1>
        <p>От северного до южного полюса!</p>
        @if (Route::has('login'))
                @auth
                    <form class="" enctype="multipart/form-data" action="/searchtour" method="post">
                        <input type="text" class="town-input form-control" name="fromTown" placeholder="Город вылета" required>
                        <input type="text" class="town-input form-control" name="toTown" placeholder="Город прилета" required>
                        <input type="date" class="form-control" name="tripStart" placeholder="Дата вылета" required>
                        <input type="number" class="form-control" name="tripDays" placeholder="Длительность" required>
                        <input type="number" name="hotelStars" min="1" max="5" step="1" placeholder="1-5 звезд" required>
                        <input type="text" data-people="1;0" placeholder="1 взр." required>
                        <input type="submit" value="Поиск" class="btn-lg">
                    </form>
                @else
                <a class="btn btn-primary btn-lg" href="{{ route('login') }}">Войти</a>
                <a class="btn btn-success btn-lg" href="{{ route('register') }}">Регистрация</a>
                @endauth
        @endif
    </div>
@endsection

Routed it like this:
Route::apiResource('searchtour','SearchController');

When I click Submit on the form, I get an error: "The page has expired due to inactivity. Please refresh and try again." And when I myself go to / searchtour, the template that I set comes out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2019-05-18
@JaxAdam

CSRF

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question