我正在尝试将值从视图传递到控制器,但它不起作用,它只发送了“已批准”我的观点<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 .');}
1 回答
至尊宝的传说
TA贡献1789条经验 获得超10个赞
在您的option标签中select没有使用value属性。所以它会将 null 传递给控制器。
更改选项标签如下:
<option value="APPROVED" style="color:green">WITH DIGITAL SIGNATURE</option>
<option value="NOT-APPROVED" style="color:green">WITHOUT DIGITAL SIGNATURE</option>
更改您的控制器:
if($request->digital_signature == 'APPROVED'){
// your code
}
elseif($request->digital_signature == 'NOT-APPROVED'){
// your code
}
- 1 回答
- 0 关注
- 110 浏览
添加回答
举报
0/150
提交
取消