laravel表单会继续重定向到同一页面

时间:2019-06-12 14:55:13

标签: laravel forms laravel-5 eloquent

“我的表单”出了什么问题,它会不断重定向到同一页面,并在URL中添加令牌,以免发生这种情况

  <form action="{{url('variant')}}" method="POST">
                          @csrf

                          <div class="required field">
                    <div class="ui dropdown ui selection dropdown" style="max-width: 300px; margin-right: 17px;">
                          <i class="dropdown icon"></i>
                          <div class="default text">Soluation Body</div>
                          <div class="menu">
                          <div class="item" data-value="male">File Upload <span style="color: gray;">( zip )</span></div>
                          <div class="item" data-value="female">repository <span style="color: gray;">( github , gitlap ,...)</span></div>
                          <div class="item" data-value="female">List <span style="color: gray;">( futuers , basics )</span></div>
                          <div class="item" data-value="female">Code Editor <span style="color: gray;">( Code )</span></div>
                          <div class="item" data-value="male">Image <span style="color: gray;">( analysis || flow chart )</span></div>
                          </div>
                    </div>
                    <button  type="submit" class="ui button">Add</button>
              </div>
              </form>

我的路线

     Route::post('variant', 'v1\AnswerController@variants')->name('variant.add');

我的控制器

public function variants(Request $request)
{
    dd('No file');
}

1 个答案:

答案 0 :(得分:1)

尝试将表单操作更改为使用路由:

<form action="{{ route('variant.add') }}">