I'm developing a registration page and I'm validating it with PHP. I would like to notify the user on the same registration page when there are any errors.
Below is the form code (it has a session.start()
in the file):
<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>