为了账号安全,请及时绑定邮箱和手机立即绑定

根据我的报告,我的表单未保存在数据库中

根据我的报告,我的表单未保存在数据库中

PHP
慕哥6287543 2022-01-08 16:52:53
我正在制作一个新的报告系统,我刚开始,设计已经完成,但是当我按下提交时,数据库中没有发生任何事情,我得到0条记录。我的代码有什么问题?或者我需要添加更多内容?我的观点:<!-- Modal --><div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">  <div class="modal-dialog" role="document">    <div class="modal-content" style="top: 50px">      <div class="modal-header" style="border-bottom: none">        <button type="button" class="close" data-dismiss="modal" aria-label="Close">          <span aria-hidden="true">&times;</span>        </button>      </div>      <div class="modal-body">        <div class="container">    <div class="row">        <section>        <div class="wizard col-md-6" style="right: 5px;margin: 0px auto">            <div class="wizard-inner">                <div class="connecting-line"></div>                <ul class="nav nav-tabs" role="tablist" style="margin: 0px auto">                    <li role="presentation" class="active">                        <a href="#step1" data-toggle="tab" aria-controls="step1" role="tab" title="Step 1">                            <span class="round-tab">                                <i class="icon-pencil"></i>                            </span>                        </a>                    </li>                    <li role="presentation" class="disabled">                        <a href="#step2" data-toggle="tab" aria-controls="step2" role="tab" title="Step 2">                            <span class="round-tab">                                <i class="icon-note"></i>                            </span>                        </a>
查看完整描述

2 回答

?
阿晨1998

TA贡献2037条经验 获得超6个赞

在 Form 标签内添加您的表单提交目的地和提交类型。目前表单标签内没有任何内容。并且不要忘记在表单中添加 csrf 字段。


例子:


<form role="form" action="{{ action('CareerSolutionController@careerReport') }}" method="post">

{!! csrf_field() !!}

或者


<form role="form" action="{{ url('career_report') }}" method="post">

{!! csrf_field() !!}


查看完整回答
反对 回复 2022-01-08
?
摇曳的蔷薇

TA贡献1793条经验 获得超6个赞

我看到了问题,您从未在刀片中定义表单操作,因此表单不知道该做什么。将您的表单打开更改为:

<form role="form" action="{{ action('CareerSolutionController@careerReport') }}>

并且不要忘记在其下方添加 crsf 令牌:

@csrf

或者为方便起见,为您的路线添加自定义名称:

Route::post('career_report', 'CareerSolutionController@careerReport')->as('career.report');

并像这样以您的形式使用它:

<form role="form" action="{{ route('career.report') }}" method=POST>


查看完整回答
反对 回复 2022-01-08
  • 2 回答
  • 0 关注
  • 160 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号