How to filter table (visible option) when is clicked dropdown select tag - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Wednesday, August 17, 2022

How to filter table (visible option) when is clicked dropdown select tag

I have problem with filtering my table. Table is formed with data from database. I have 5 columns where values are 1 or 0 (int) - depends what user clicked in sing-in form. Beside, i have select tag where i have those 5 options. I need a solution. If i click one of options, whole rows disapear where that same name column is 0.

<select name="filter">
    <option value="none">No filter</option>
    <option value="value1" onclick="function1()">value1</option>
    <option value="value2" onclick="function2()">value2</option>
    <option value="value3" onclick="function3()">value3</option>
    <option value="value4" onclick="function4()">value4</option>
    <option value="value5" onclick="function5()">value5</option>
</select>

This down is piece of whole table where i have 1 or 0 values. And output from table is working properly.

<td <input type="hidden" name="value1" value="<?=$row['value1']?>"><?=$row['value1']?></td>
<td <input type="hidden" name="value2" value="<?=$row['value2']?>"><?=$row['value2']?></td>
<td <input type="hidden" name="value3" value="<?=$row['value3']?>"><?=$row['value3']?></td>
<td <input type="hidden" name="value4" value="<?=$row['value4']?>"><?=$row['value4']?></td>
<td <input type="hidden" name="value5" value="<?=$row['value5']?>"><?=$row['value5']?></td>



EDIT (source):

<td> <input type="hidden" name="value1" value="1">1</td>
<td> <input type="hidden" name="value2" value="0">0</td>
<td> <input type="hidden" name="value3" value="1">1</td>
<td> <input type="hidden" name="value4" value="1">1</td>
<td> <input type="hidden" name="value5" value="0">0</td>


source https://stackoverflow.com/questions/73335453/how-to-filter-table-visible-option-when-is-clicked-dropdown-select-tag

No comments:

Post a Comment