HERE'S CONTROLLER:
以下是控制器:
public function search(Request $request){
$search = $request->search;
$students = StudentsList::where('Student_no','Like','%'.$search.'%')->first();
return view('front.vendors.login_register')->with(compact('students'));
}
HERE'S ROUTE:
以下是路线:
Route::get('search/studno','VendorController@search');
HERE'S BLADE FILE:
以下是刀片式服务器文件:
<input type="text" id="vendorfname" name="Fname"
class="text-field" value="{{$students['Fname']}}"
readonly="">
更多回答
When i try to re open the page it alway says (Undefined variable $students)
当我尝试重新打开页面时,它总是显示(未定义变量$Students)
I want to fetch the searched data in input field please send help
我想在输入栏中取回搜索到的数据,请发送帮助
I've also tried this but still same problem coming up <input type="text" id="vendorfname" name="Fname" class="text-field" value="{{ $students->Fname}}" readonly="">
我也尝试过这个方法,但还是出现了同样的问题
You use $studentsList in your blade without compact the value of $studentsList from controller.
您在刀片中使用了$StudentsList,而没有从控制器压缩$StudentsList的值。
优秀答案推荐
Because you are using compact
and sometimes $students might be false. Please use with
instead of compact.
因为您使用的是精简的,有时$Students可能是假的。请配合使用,而不是紧凑型。
更多回答
SEARCH BUTTON <form id="vendorSearch" action="{{ url('/search/studno') }}" method="get">@csrf <div class="searchpanel"> <input class="searchbox" type="search" name="search" placeholder="Search Your Student No." aria-label="Search" required=""> <input type="submit" class="searchbtn" value="Search"></button> </div> </form>
搜索按钮
Here's my code in search button
这是我在搜索按钮中的代码
I changed my answer.
我改变了我的答案。
我是一名优秀的程序员,十分优秀!