Php 表格未在第5页提交
我想在laravel 5中提交表单,但它不调用更新函数Php 表格未在第5页提交,php,laravel,Php,Laravel,我想在laravel 5中提交表单,但它不调用更新函数 <form class="form-horizontal", role="form" method="patch" action{{url('/user/'.$user->id) }}"> <input type="hidden" name="_token" value="{{ csrf_token() }}"> <div class="form-group"> <label
<form class="form-horizontal", role="form" method="patch" action{{url('/user/'.$user->id) }}">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group">
<label class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input type="text" class="form-control" name="name" value="{{ $user- >name }}">
</div>
</div>
</form>
id)}}>
名称
操作不正确。缺少=和开始”。下课后你也有一个。无效的html
如果您想将参数传递给URL,那么也许您应该考虑这个问题。
url('foo/bar', $parameters = [], $secure = null);
您的html无效,缺少
操作
属性。HTML表单通常应采用以下形式:
<form action="where/form/submits/to" method="form-method"> ... </form>
。。。
有关表单元素的详细信息,请参见。
在您的情况下,应该是这样的:
<form class="form-horizontal", role="form" method="patch" action="{{url('/user/'.$user->id) }}"> ... </form>
。。。
操作的属性不完整,应该是action=“…”
您也可以使用路由而不是url,例如
在刀片中:
<form class="form-horizontal", role="form" method="patch" action="{{ route('user.show') }}">
请修复问题标题中的打字错误。我正在使用action=“{route(url('/user/'.$user->id)}}”但不起作用。您的表单也缺少提交按钮。我没有使用show函数,我使用user edit.blade.php作为html表单,然后我将此表单发送到UserController中的更新函数,作为公共函数更新($id){$user=user::find($id);$user->name=Request::input('name');$user->email=Request::input('email');$user->mobile=Request::input('mobile');$user->save();返回视图('user/index');}我没有使用show函数,我使用user edit.blade.php编辑html表单,然后我将此表单作为公共函数更新($id){$user=user::find($id);$user->name=Request::input('name');$user->email=Request::input('email');$user->mobile=Request::input('mobile');$user->save();返回视图('user/index');}
Route::get('user/{id}', [
'uses' => 'UsersController@action',
'as' => 'user.show'
]);