Php 未发送表单-laravel
我正试图通过填写表格将公告添加到数据库中 这是我的HTML:Php 未发送表单-laravel,php,laravel,laravel-5.3,Php,Laravel,Laravel 5.3,我正试图通过填写表格将公告添加到数据库中 这是我的HTML: <div class="remodal" data-remodal-id="modal" data-remodal-options="closeOnOutsideClick: false"> <button data-remodal-action="close" class="remodal-close"></button> <h1>Post a new Announcement<
<div class="remodal" data-remodal-id="modal" data-remodal-options="closeOnOutsideClick: false">
<button data-remodal-action="close" class="remodal-close"></button>
<h1>Post a new Announcement</h1>
<hr />
<form method="POST">
<label><h4>Subject</h4>
<input name="newsTitle" type="text" placeholder="Announcement title">
</label>
<label><h4>Body</h4>
<textarea name="newsBody" placeholder="Write the announcement message here"></textarea>
</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<br>
<button data-remodal-action="cancel" class="remodal-cancel">Cancel</button>
<button type="submit" name="newAnnPost" class="remodal-confirm">POST</button>
</form>
</div>
当我按下带有type=“submit”的POST按钮时,页面变为空白、白色,什么也没有发生
此外,表单处于模式中,当我打开模式时,我会得到…/backend#model,而不是…/backend,这可能也是一个问题吗?将
操作
属性添加到表单中
在控制器中,返回重定向('/backend')将表单重定向回同一页面
为
后端创建一个get路由
或重定向到另一个路由
您忘记指定路由
以你的形式。添加以下内容:
<div class="remodal" data-remodal-id="modal" data-remodal-options="closeOnOutsideClick: false">
<button data-remodal-action="close" class="remodal-close"></button>
<h1>Post a new Announcement</h1>
<hr />
<form method="POST" action="{{URL:to('/backend')}}">
<label><h4>Subject</h4>
<input name="newsTitle" type="text" placeholder="Announcement title">
</label>
<label><h4>Body</h4>
<textarea name="newsBody" placeholder="Write the announcement message here"></textarea>
</label>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<br>
<button data-remodal-action="cancel" class="remodal-cancel">Cancel</button>
<button type="submit" name="newAnnPost" class="remodal-confirm">POST</button>
</form>
</div>
发布新公告
主题
身体
取消
邮递
并重定向到控制器上的不同位置。首先,我在表单标记中没有看到操作属性,它应该是这样的
<form method="POST" action="/backend">
请求将不包含newAnnPost,但它将包含其他2个输入标记,而不是submit按钮,据我所知,在提交表单时,它不会序列化为表单输入
<form method="POST" action="/backend">
$request->has('newAnnPost')