gpt4 book ai didi

Undefined variable $students - This always come up. can someone help me about this problem(未定义变量$SENTERS--总是出现这种情况。有人能帮我解决这个问题吗?)

转载 作者:bug小助手 更新时间:2023-10-25 18:46:55 28 4
gpt4 key购买 nike



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

我想在输入栏中取回搜索到的数据,请发送帮助

<input type="text" id="vendorfname" name="Fname" class="text-field" value="{{ $students['Fname']}}" readonly="">

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>

搜索按钮

@CSRF

Here's my code in search button

这是我在搜索按钮中的代码

I changed my answer.

我改变了我的答案。

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com