1 回答
TA贡献1856条经验 获得超17个赞
<select id="ddselect" name='subject_name' class="signup" required >
<option value=""> Select Subject to Monitor </option>
@foreach($subjectDetails as $s)
<option value={{ $s['id'] }}>{{ $s['subject_name'] }}</option>
@endforeach
</select>
//在你的控制器中,你可以通过subject_name获取你的id
$s1 = Input::get('subject_name');
//after that get subject name based on that id
$sample=DB::table('tablename')->where('id',$s1)->first();
//then you can store both id and name separately
$subjects = new Subject();
$subjects->user_id = Auth::user()->id;
$subjects->subject_name = $sample->subjectname;
- 1 回答
- 0 关注
- 115 浏览
添加回答
举报