Jump to content
Fórum Script Brasil
  • 0

validação de form


Olá, tenho um form q está me deixando louco, não sei o que está errado, quando faço require_once na pág do form ele some.

img 01 - sem o validador

img 02 - com validado


1- index

<?php require_once("includes/validarform.php");?>

<form method="post" action="manipulador.php">


<div><i id="icone" class="w3-xlarge far fa-user"></i><input type="text" placeholder="Nome" name="nome" size="10"><span class="error">* <?php echo $nomeErr;?></span></div>

<div><i id="icone" class="w3-xlarge far fa-envelope"></i><input type="email" placeholder="E-Mail" name="email" size="10"></div>

<div><i id="icone" class="w3-xlarge fab fa-whatsapp"></i><input type="tel" placeholder="Whatsapp" name="telefone" size="10"></div>

<div><i id="icone" class="w3-xlarge fas fa-pencil-alt"></i><textarea name="msg"></textarea></div>

<div><input type="submit" name="Enviar" value="Enviar" class="w3-button w3-block"></div>




2- validador


$nome = $email = $telefone = $msg= "";



$nome = test_input($_POST["nome"]);

$email = test_input($_POST["email"]);

$telefone = test_input($_POST["telefone"]);

$msg = test_input($_POST["msg"]);



function test_input($data) {

$data = trim($data);

$data = stripslashes($data);

$data = htmlspecialchars($data);

return $data;








Edited by fabiosmoura
Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...