Created
July 20, 2013 22:35
-
-
Save InFog/6046684 to your computer and use it in GitHub Desktop.
Exemplo para o blog, PHP Procedural
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$idade = trim($_POST['idade']); | |
$erro = false; | |
if (empty($idade)) { | |
$erro = 'Idade não pode ser vazia'; | |
} elseif (! is_numeric($idade)) { | |
$erro = 'Idade deve ser numérica'; | |
} elseif ($idade < 18) { | |
$erro = 'Cliente não pode ser menor de 18 anos'; | |
} | |
if (! $erro) { | |
exibe_pagina(); | |
} else { | |
exibe_erros($erro); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment