Created
May 17, 2016 17:22
-
-
Save joffilyfe/d6ae8f2d6e5edaa82c7d7323576b0dd3 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<title>Teste de formulário</title> | |
<meta charset="utf8"> | |
<style> | |
* {box-sizing: border-box;} | |
body { | |
font-family: sans-serif; | |
color: #555; | |
} | |
div.welcome { | |
background: #eee; | |
padding: 20px 30; | |
border-radius: 4px; | |
width: 50%; | |
} | |
fieldset { | |
border: 0; | |
} | |
fieldset input { | |
width: 50%; | |
border: 1px solid #ccc; | |
border-radius: 4px; | |
padding: 20px; | |
} | |
button { | |
padding: 10px 20px; | |
border: 0; | |
background: #2a94d6; | |
color: #fff; | |
font-size: 18px; | |
font-weight: lighter; | |
border-radius: 4px; | |
} | |
pre { | |
background: #FFC2C2; | |
padding: 20px; | |
font-size: 18px; | |
} | |
</style> | |
</head> | |
<body> | |
<form action="/form.php" method="POST"> | |
<fieldset> | |
<div class="welcome"> | |
<h1>Formulário de testes</h1> | |
</div> | |
</fieldset> | |
<!--<fieldset> | |
<input type="text" name="nome" placeholder="Digite o seu nome" required> | |
</fieldset> | |
<fieldset> | |
<input type="text" name="login" placeholder="Digite o nome do seu usuário" required> | |
</fieldset> | |
<fieldset> | |
<input type="password" name="password" placeholder="Digite sua senha" required> | |
</fieldset>--> | |
<fieldset> | |
<input type="text" name="cpf" placeholder="Informe o CPF"> | |
</fieldset> | |
<fieldset> | |
<button>Enviar</button> | |
</fieldset> | |
</form> | |
<?php | |
$clientes = array( | |
'11' => "Primeiro cliente", | |
'22' => "Segundo cliente" | |
); | |
?> | |
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST'): ?> | |
<!-- | |
<h1>Debug: <?php echo $_SERVER['REQUEST_METHOD']; ?></h1> | |
<?php echo "<pre>", var_dump($_POST), "</pre>"; ?> | |
--> | |
<?php if (isset($_POST['cpf']) && strlen($_POST['cpf']) > 0): ?> | |
<h1>Cliente: <?php echo $clientes[$_POST['cpf']]; ?></h1> | |
<?php endif; ?> | |
<?php endif; ?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment