Revision: 34020
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 16, 2010 01:16 by wesleymacente
Initial Code
< ?php function hs($str) { return htmlspecialchars($str); } function clear_post() { $_POST['nome'] = $_POST['assunto'] = $_POST['email'] = $_POST['msg'] = null; } if (isset($_POST['enviar'])) { if (empty($_POST['nome']) or empty($_POST['assunto']) or !is_email($_POST['email']) or empty($_POST['msg']) ) { $info = 'Preencha todos campos corretamente.'; } else { $headers = 'From: ' . $_POST['email'] . " " . 'Reply-To: ' . $_POST['email'] . " " . 'X-Mailer: PHP/' . phpversion(); if(@mail(get_bloginfo('admin_email'), $_POST['assunto'], $_POST['msg'], $headers)) { $info = 'E-mail enviado com sucesso.'; clear_post(); } else { $info = 'Erro no servidor.'; } } } else { clear_post(); } ?> HTML>>>>>>>>>>>>>>>>>>>>>>>>>>>>> <form method="post" action="" class="contato"> < ?php if (isset($info)) echo '<div class="info">' . $info . ' <div> <label for="nome">* Nome</label><br /> <input type="text" name="nome" value="<?php echo hs($_POST['nome']) ?/>" id="nome" /> </div> <div> <label for="email">* E-mail</label><br /> <input type="text" name="email" value="<?php echo hs($_POST['email']) ?/>" id="email" /> </div> <div> <label for="assunto">* Assunto</label><br /> <input type="text" name="assunto" value="<?php echo hs($_POST['assunto']) ?/>" id="assunto" /> </div> <div> <label for="msg">* Mensagem</label><br /> <textarea name="msg">< ?php echo hs($_POST['msg']) ?></textarea> </div> <div> <input type="submit" name="enviar" value="Enviar" /> </div> </form>
Initial URL
Initial Description
Initial Title
Contact PHP validation n HTML
Initial Tags
Initial Language
XHTML