-4
Can you explain to me why the code below does not work? It is giving error when I run.
Displays the error below:
Follow the code in the Pastebin: https://pastebin.com/6pH5AW4i
-4
Can you explain to me why the code below does not work? It is giving error when I run.
Displays the error below:
Follow the code in the Pastebin: https://pastebin.com/6pH5AW4i
0
In this case you can use the function "isset" 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 thing in these cases is to disable some PHP errors so that this type of warning does not go off. For this you need to add some exceptions in your file "php.ini".
It is also possible to disable these errors by calling this Function:
error_reporting(0);
It worked perfectly, thank you!!
Browser other questions tagged php twitter-bootstrap web-application
You are not signed in. Login or sign up in order to post.
The variable
$sexo
is not initialized– edson alves
Do you know how to fix it? I’m very Noob about it...
– Marcos Delano
You can add one more condition in your if
(!empty($sexo) && $sexo=="F" )
– edson alves
just declare the variable sex at the beginning of PHP
<?php $sexo=''; ?>
– user60252
Where does the variable sex value come from?
– user60252