How to show the value of 1 of a check as a text

0

Change value = 1 to "Active" or value = 0 to "Inactive"

if (isset($active) == 1) {
  $is_active = "Activo";
}
elseif(isset($active) == 0) {
  $is_active = "Inactivo";
}

Just as it shows all as Active and there should be one inactive

    
asked by Julián Cordoba 20.07.2018 в 18:51
source

1 answer

1

You have to check two conditions, that the value exists "Y" that is equal to 1. Asi:

if (isset($active) && $active == 1) {
  $is_active = "Activo";
}
elseif(isset($active) && $active == 0) {
  $is_active = "Inactivo";
}
    
answered by 20.07.2018 / 18:54
source