0
I am developing a registration page and I am validating it with PHP. I would like to notify the user on the same registration page when there is an error.
Below is the form code (you have a session.start()
in the archive):
<form name="form" method="post" action="validacao.php">
<center>
<input type="text" name="nome" value="" maxlength="9" class="estilo_form" placeholder="Nome"/>
<input type="text" name="usuario" value="" maxlength="9" class="estilo_form" placeholder="Usuário"/>
<input type="password" name="senha" value="" maxlength="9" class="estilo_form" placeholder="Senha"/>
<input type="password" name="senhaagain" value="" maxlength="9" class="estilo_form" placeholder="Digite novamente a Senha"/>
</center>
<br/>
<input type="checkbox" name="concordar" value="S" class="input_check"/>
<font style="float:left;"/> Li e Concordo com os <a href="" class="estilo_link">Termos de uso</a>. </font>
<a href="inicio.html">
<input type="submit" name="submit" value="Enviar" class="botao2">
</a>
</form>
PHP file:
<html>
<?php session_start(); ?>
<body>
<?php
$all = $_POST;
$nome = $_POST['nome'];
$usuario = $_POST['usuario'];
$senha = $_POST['senha'];
$senha_again = $_POST['senhaagain'];
$_SESSION['validador'] = ;
if ( !isset( $all ) || empty( $all ) ) {
$_SESSION['validador'] = 1; //Validador para por um echo na pagina de cadastro, juntamente com um if.
}
?>
</body>
</html>
I believe it is just make an IF in the place you want:
<? if(condição){ echo "algo deu errado"; ?>
.– Sam
I’ve done what I wanted, thank you guys.
– pedro manoel