Tell me please. There are two select, select them and click - displays one table, select another select `a value, displays one and the previous table. I understand that it looks difficult, but understand.

<form action="" method="post" class="form_cat"> <select name="category" style="width: 200px;"> <option value="" disabled selected>Оберіть критерії</option> <option value="all">Вибрати всі</option> <option value="congrat">Привітання</option> <!--RED- --> <option value="diagnostic">Діагностика</option><!--green- --> <option value="question">Вирішення питання</option><!--blue- --> <option value="bye">Прощання</option><!--pink- --> <option value="criteria">Загальні критерії</option><!--yellow- --> <option value="conflict">Конфлікт</option><!--zero- --> </select> <select name="operators" style="width: 200px;"> <option value="" disabled selected>Оберіть оператора</option> <?php $sqli = mysqli_query($conn_oa, "SHOW TABLES FROM ".$dBNameOa); while ($rows = mysqli_fetch_row($sqli)) { echo'<option value="'. $rows[0] .'">'. $rows[0] .'</option>'; } ?> </select> --------------------------------------------------------------------------- if ($selected_category = "congrat") { $sql_support1 = "SELECT `clerk_id`, `like_1` , `like_2` , `like_3` FROM ".$selected_operator." WHERE like_1 > 3 OR like_2 > 3 OR like_3 > 3 ;"; $result_support1 = mysqli_query($conn_oa, $sql_support1); echo ' <ul> <table class="features-table table-support" > <thead> <tr> <th colspan="3" class="grey">Привітання</th> </thead> </tr> <tr> <td>Ідентифікація абонента / клієнта:'; while ($row2 = mysqli_fetch_array($result_support1)) { echo '<br>'; echo $row2['like_1']; echo '</td> <td>Звернення за ім\'ям:'; echo '<br>'; echo $row2['like_2']; echo '</td> <td>Привітання:'; echo '<br>'; echo $row2['like_3']; echo '</td>'; echo '</tr></table></ul>'; } } if ($selected_category = "diagnostic") { $sql_support1 = "SELECT `clerk_id`, `like_1` , `like_2` , `like_3` FROM ".$selected_operator." WHERE like_1 > 3 OR like_2 > 3 OR like_3 > 3 ;"; $result_support1 = mysqli_query($conn_oa, $sql_support1); echo ' <ul> <table class="features-table table-support" > <thead> <tr> <th colspan="3" class="grey">dia</th> </thead> </tr> <tr> <td>Ідентифікація абонента / клієнта:'; while ($row2 = mysqli_fetch_array($result_support1)) { echo '<br>'; echo $row2['like_1']; echo '</td> <td>Звернення за ім\'ям:'; echo '<br>'; echo $row2['like_2']; echo '</td> <td>Привітання:'; echo '<br>'; echo $row2['like_3']; echo '</td>'; echo '</tr></table></ul>'; } } 

Displays for some reason when selecting another select - the first and second table. Tell me, what's the problem? I'll be very grateful.

    1 answer 1

    because you are not doing the right condition, use a normal IDE like PhpStorm which will highlight these jambs for you

     if ($selected_category = "diagnostic") if ($selected_category = "congrat") 

    These conditions will always be fulfilled !!! need to

     if ($selected_category == "diagnostic") if ($selected_category == "congrat") 
    • Now they do not at all deduce how to be that? What is the problem? And with equal - I really did not finish. For phpstorm - thank you. But tell me where else the puncture? Thank you very much. - Andrey Kotov
    • Please tell me, I really don’t see where it’s wrong. - Andrey Kotov
    • You do not destroy the previous table. - Inquisitor