如何使用按钮搜索多种条件的数据(如果有)?

时间:2019-05-07 09:56:44

标签: php

我有问题,我无法在许多情况下使用一个按钮进行搜索。我的意思是我有3个搜索框,并且我要搜索的内容都充满了它。当我按下按钮搜索时,它不起作用。

这是填写您想要搜索的内容的表格。

        <form class="form-inline" method="post" enctype="multipart/form-data"> 
        <input class="form-control " type="text" name="pnm" placeholder="Search P/N" onkeyup="this.value = this.value.toUpperCase()" style="width: 250px;text-align: center; margin:10px; text-transform:uppercase; " > 
        </input>
        <button style="background-color:#668cff" class="btn btn-rounded btn-primary " type="submit" data-toggle="popover" data-trigger="hover" data-placement="bottom"  data-content="Search"><i class="fa fa-search"></i></button>            

        <form class="form-inline" method="post" enctype="multipart/form-data"> 
        <input class="form-control " type="text" name="req" placeholder="Search RQ" onkeyup="this.value = this.value.toUpperCase()" style="width: 250px;text-align: center; margin:10px; text-transform:uppercase; " > 
        </input>
        <button  style="background-color:#ffff66" class="btn btn-rounded btn-primary " type="submit" data-toggle="popover" data-trigger="hover" data-placement="bottom"  data-content="Search"><i class="fa fa-search"></i></button>   

        <div class="col-sm-5 form-inline">
            <p align="left"><label class="col-sm-7 control-label">Status</label></p>

            <p align="left"><select name="status" class="custom-select"></p>
            <option value=""><none></option>
            <option value="OPEN">Open</option>
            <option value="CLOSED">Closed</option>


            </select>

这是其他条件

     $ornum=''; $orline='';
     $stat='';
     $pnm = $_POST['pnm'];
     $stat = $_POST['status'];
     $filt='';

     if (isset($_REQUEST['req']) && $_REQUEST['req']!=''){$filt = ' and c.requisition =\''. $_POST['req'].'\'';}
     else {$req = '';}

     if (isset($tgl_awal1) && isset($tgl_akhir1)) {$filt = " and D.CREATED_DATE BETWEEN TO_DATE('$tgl_awal1', 'yyyy-mm-dd') AND TO_DATE('$tgl_akhir1', 'yyyy-mm-dd')";}
     else {$req = '';}

     if (isset($_REQUEST['submit_btn']))  { $stat = $_POST['status'];} 
    // if (isset($_REQUEST['submit_btn']))  { $stat = $_POST['status'];}

0 个答案:

没有答案