samedi 28 mai 2022

Is there a way to do a different query if checkbox is unchecked

Here is what I have so far. My issue is with the if statement.

echo "<div>
        <input type='checkbox' id='retired' name='retired' checked>
        <label for='retired'>Hide Retired Systems</label>
      </div>";
$sql = 'SELECT * FROM db WHERE `Physical Location` != "RETIRED"';
$sql_all = 'SELECT * FROM db';

if (checkbox retired = True):
   showDBtable($sql);
else:
   showDBtable($sql_all);

I understand I should be using JavaScript but is there any way to do this via PHP/HTML. I don't mind if the whole page reloads. I'm thinking I have to update the POST var on the checkbox click so then when the page reloads, it knows which query to choose.




Aucun commentaire:

Enregistrer un commentaire