I'm trying to create a simple function, to write the title according to the gender selection in the form, but I must be doing something wrong:
$sexo = empty($_POST['sexo']) ? "[sexo]" : $_POST['sexo'];
function mudasexo($sexo) {
if ($sexo == "masculino") {
echo "O senhor";
}
else {
echo "A senhora";
}
}
So I wanted to use this function inside HTML texts with: <?php mudasexo() ?>
but it is not working. It does not report any errors when debug , but the page does not even open.