Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
radiobutton.php
<!DOCTYPE html>
<html>
<body>
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!isset($_POST['genero'])) {
echo'Por favor, marque o sexo<hr>';
} else {
$genero = $_POST['genero'];
echo 'Seu sexo é ' . $genero . '<hr>';
}
}
?>
<form action="" method="post">
<input type="radio" name="genero" value="masculino"> Masculino<br>
<input type="radio" name="genero" value="feminino"> Feminino<br>
<br>
<input type="submit">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.