我正在尝试将值从视图传递到控制器,但它不起作用,仅发送了“ APPROVED”
我的观点
<div class="form-group row">
<label for="colFormLabelLg" class="col-md-2 col-sm-3 control-label control-label-lg"><b>DIGITAL SIGNATURE</b></label>
<div class="col-md-3">
<div class="form-group" id=digital_signature >
<select class="form-control" name="digital_signature" value="{{ old('digital_signature') }}" required autofocus >
<option value=""></option>
<option style="color:green">WITH DIGITAL SIGNATURE</option>
<option style="color:green">WITHOUT DIGITAL SIGNATURE</option>
</select>
</div>
</div>
</div>
我的控制器
public function new_approvel_update(Request $request, $id)
{
if($request->digital_signature == 'WITH DIGITAL SIGNATURE')
{
$input= Student::Where('delete_status','NOT DELETED')->find($id);
$input['center_approved'] = strtoupper ('APPROVED');
$input['date_of_join'] = $request->date_of_join;
} elseif($request->digital_signature == 'WITHOUT DIGITAL SIGNATURE') {
$input= Student::Where('delete_status','NOT DELETED')->find($id);
$input['center_approved'] = strtoupper ('NOT-APPROVED');
$input['date_of_join'] = $request->date_of_join;
}
$certificate->save();
return redirect('new_application')->with('success',' APPLICATION APPROVED SUCCESSFULLY .');
}
答案 0 :(得分:0)
在option
的{{1}}标记中,您没有使用select
属性。因此它将null传递给控制器。
如下更改选项标签:
value
更改控制器:
<option value="APPROVED" style="color:green">WITH DIGITAL SIGNATURE</option>
<option value="NOT-APPROVED" style="color:green">WITHOUT DIGITAL SIGNATURE</option>