jeudi 20 octobre 2016

PHP-YII2 How to read the directory based on checked checkbox?

i have a code in view, this code is show list of folder. if we click in checkbox, we only read file in directory what user's check the checkbox. e.g user click on Database log, the table will show the file in folder in database log only.

    <div class="list-group col-lg-3">
            <li class="list-group-item"><input type="checkbox" value ="DB_log"/>&nbsp;</a>Database Log</li>
            <li class="list-group-item"><input type="checkbox" value ="Img_log"/>&nbsp;</a>Image Log</li>
            <li class="list-group-item"><input type="checkbox" value ="Backend_log"/>&nbsp;</a>Backend Log</li>
            <li class="list-group-item"><input type="checkbox" value ="OS_log"/>&nbsp;</a>Operating System Log</li>
            <li class="list-group-item"><input type="checkbox" value ="Softwaregeneral_log"/>&nbsp;</a>Software General Log</li>
            <li class="list-group-item"><input type="checkbox" value ="Config_File"/>&nbsp;</a>Config File</li> 
    </div>  

<?= GridView::widget([
    'dataProvider' => $provider,
    'columns' => 
                  [
                    'name'
                  ],
              ]); 
?>

i want, the gridview is only show a file in checked checkbox, e.g in database log contains a.txt, b.txt. if we check database log, we show in gridview is only a.txt and b.txt. the step is : 1. check checklist box. 2. click button select. 3. file in selected directory is show in table/gridview.




Aucun commentaire:

Enregistrer un commentaire