Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 按按钮时显示隐藏表_Php_Laravel_Laravel 5 - Fatal编程技术网

Php 按按钮时显示隐藏表

Php 按按钮时显示隐藏表,php,laravel,laravel-5,Php,Laravel,Laravel 5,我有一个用户输入数据的搜索表单。在搜索按钮上单击,如果找到数据,则仅显示表格tbl_paytable,否则将其隐藏 查看页面 <form class="form-horizontal" method="POST" action="{{action('OrderedBookController@billPay')}}" enctype="multipart/form-data"> {{ csrf_field() }} <div cl

我有一个用户输入数据的搜索表单。在搜索按钮上单击,如果找到数据,则仅显示表格
tbl_paytable
,否则将其隐藏

查看页面

<form class="form-horizontal" method="POST" action="{{action('OrderedBookController@billPay')}}" enctype="multipart/form-data">
                {{ csrf_field() }}
        <div class="row" style="padding-left: 1%;">
                <div class="col-md-4">
                    <div class="form-group">
                        <label>Bill Number</label><span class="required">*</span>
                        <input type="text" maxlength="15" required="required" autofocus="autofocus" autocomplete="off" name="NBillNumber" class="form-control"/>                                
                    </div> 
                </div> 
                <div class="col-md-4">
                    <div class="form-group"></div> 
                    <div class="form-group" style="padding-left: 5%;">
                        <button type="submit" class="btn btn-primary">Search</button>        
                    </div> 
                </div>                      
        </div>
</form>

<div id="tbl_paytable">
// display table 
</div>

$billsrch是一个laravel集合,它有一个方法来检查它是否为空

@if($billsrch)
//展示台
@恩迪夫
或者只需像在控制器中一样进行操作

@if(count($billsrch) > 0)
  <div id="tbl_paytable">
  // display table 
  </div>
@endif
@if(计数($billsrch)>0)
//展示台
@恩迪夫

您能更清楚地解释您的问题吗?使用ajax调用并将响应显示到div中,或者只在控制器中提交和重定向回同一刀片服务器,在刀片服务器文件中使用
@if(session('something'))@endif
将tablegetting错误显示为
未定义变量:billsrch
on
@if($billsrch->isNotEmpty())
块这意味着您的代码:
$billsrch=OrderedBook::where('BilledNum',$billNum)->get();
返回null。我将更改我的答案
@if($billsrch)
   <div id="tbl_paytable">
   // display table 
   </div>
@endif
@if(count($billsrch) > 0)
  <div id="tbl_paytable">
  // display table 
  </div>
@endif