亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從下拉 Laravel 中獲取所選值時始終獲取 NULL

從下拉 Laravel 中獲取所選值時始終獲取 NULL

PHP
冉冉說 2021-10-22 15:01:00
我試圖通過我的控制器從我視圖中的下拉列表中獲取選定的值,但它總是返回null. 我真的不知道為什么。這是我的選擇下拉列表: 更新:這是我的完整刀片視圖!@extends('backpack::layout')@section('header')    <section class="content-header">        <h1>            <span class="text-capitalize">Thành tích t?t nh?t ngày</span>        </h1>        <ol class="breadcrumb">            <li><a href="/admin/dashboard">Admin</a></li>            <li><a href="/admin/cache-club-earth">Thành tích t?t nh?t ngày</a></li>            <li class="active">List</li>        </ol>    </section>@endsection@section('content')    <form method="GET">        L?c round:            <select id="tablefilter" name="tablefilter">            <option value="0">Hi?n t?i</option>                @foreach($max as $item)                <option value="{{$item->countRound}}">{{$item->countRound}}</option>            @endforeach            </select>    </form>        <table id="currentRound" class="table table-striped table-bordered" style="width:100%">        <thead>            <tr>                <th>Cau l?c b?</th>                <th>Qu?ng ???ng</th>                <th>Qu?ng ???ng trung bình</th>                <th>X?p h?ng</th>                <th>S? thành viên</th>                <th>Ngày x?p h?ng</th>            </tr>        </thead>        <tbody>        @foreach ($result as $item)            <tr>                <td>{{$item->name}}</td>                <td align="right">{{number_format($item->total_distance/1000, 2)}} km</td>                <td align="right">{{number_format($item->avg_distance/1000, 2)}} km</td>                <td align="right">{{number_format($item->rank)}}</td>                <td align="right">{{$item->total_member}}</td>                <td>{{$item->created_at}}</td>            </tr>        @endforeach        </tbody>    </table>
查看完整描述

3 回答

?
幕布斯6054654

TA貢獻1876條經驗 獲得超7個贊

您需要使用按鈕提交表單值或使用ajax發送表單值


這里是通過表單提交的基本數據(我指定了如果您轉到不同頁面的操作)


    <form method="GET" action="{{url('/to/index/controller/you-want')}}>

        L?c round:

            <select id="tablefilter" name="tablefilter">

                <option value="0">Hi?n t?i</option>


                @foreach($max as $item)

                     <option value="{{$item->countRound}}">{{$item->countRound}}</option>

                @endforeach


            </select>

            <button class="something">Update</button>


    </form>


查看完整回答
反對 回復 2021-10-22
?
回首憶惘然

TA貢獻1847條經驗 獲得超11個贊

你可以這樣做: dd(request->all()); 用于檢查數據。我認為您不必使用輸入功能。嘗試這個 :

$round = $request->tablefilter;


查看完整回答
反對 回復 2021-10-22
?
慕絲7291255

TA貢獻1859條經驗 獲得超6個贊

 @foreach($max as $item)

     <option value="{{$item}}">{{$item}}</option>

 @endforeach


查看完整回答
反對 回復 2021-10-22
  • 3 回答
  • 0 關注
  • 186 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號