PHP / Bootstrap radio selector does not work

-4

Can you explain why the code below does not work? You're giving me an error when I run.

Displays the error below:

Followthecodeinpastebin: link

    
asked by anonymous 14.12.2018 / 16:25

1 answer

0

In this case you can use the " isset " function to test if the variable exists:

<input class="form-check-input" type="radio" name="sexo" id="sexo" value="M" <?php echo isset($sexo) && $sexo == "M" ? "checked" : null; ?>/> Masculino

However, the most common in these cases is to disable some PHP errors so that this type of warning does not fire. For this you need to add some exceptions to your " php.ini " file.

You can also disable these errors by calling this function:

error_reporting(0);
    
14.12.2018 / 19:10