Skip to content

Instantly share code, notes, and snippets.

@InFog
Created July 20, 2013 22:35
Show Gist options
  • Save InFog/6046684 to your computer and use it in GitHub Desktop.
Save InFog/6046684 to your computer and use it in GitHub Desktop.
Exemplo para o blog, PHP Procedural
<?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