I am updating my sql query based on the selection made on checkbox
$selected = ($data['selected'] == true) ? 1 : 0;
echo $data['selected'];
//prints true when checkbox is checked
//prints false when unchecked
echo $sql = "update test_table set selected = " . $selected . " where id = " . $data['product_id'];
But in both cases $selected is set to 1 . When
$data['selected'] == false it should save $selected = 0 but it does not.
What am I missing?
Aucun commentaire:
Enregistrer un commentaire