Hola: tengo este formulario. Quiero validar los distintos campos para que el usuario no deje casillas en blanco; y ademas que Contraseña y repcont sean iguales.
Solo si se cumplen esas condiciones, se madan los datos a insertar.php.
Código PHP:
<style type="text/css">
<!--
body {
background-color: #8fbee8;
}
.Estilo1 {
color: #FFFFFF;
font-weight: bold;
font-size: 24px;
}
.Estilo2 {color: #FFFFFF}
-->
</style>
<div align="center" class="Estilo1"><u>Formulario de Registro </u></div>
<table width="780" border="0">
<tr>
<td> </td>
</tr>
<tr>
<td><strong><span class="Estilo2">Si eres nuevo en esta página, primero deberás registrarte.</span></strong></td>
</tr>
<tr>
<td><strong><span class="Estilo2">Para ello debes rellenar este formulario con tus datos personales. </span></strong></td>
</tr>
</table>
<form id="form1" name="form1" method="post" action="insertar.php">
<label><strong>Apellido</strong>
<input name="apellido" type="text" tabindex="1" size="30" />
<br>
</label>
<label><strong><br />
Nombres</strong>
<input name="nombres" type="text" tabindex="2" size="50" />
<br>
</label>
<label><strong><br />
DNI</strong>
<input name="dni" type="text" id="dni" tabindex="3" size="10" />
<br>
</label>
<label><strong><br />
Telefóno</strong>
<input name="telefono" type="text" tabindex="4" size="15" />
</label>
<label><strong> Celular / Móvil</strong>
<input name="celular" type="text" tabindex="5" size="15" />
</label>
<label><strong><br>
<br />
Domicilio</strong>
<input name="domicilio" type="text" tabindex="6" size="100" />
</label>
<label><strong><br>
<br />
Mail</strong>
<input name="mail" type="text" tabindex="7" size="30" />
<br>
</label>
<label><strong><br />
Contraseña</strong>
<input name="contrasena" type="password" tabindex="8" />
</label>
<label><strong> Repetir contraseña</strong>
<input name="repcont" type="password" tabindex="9" />
<br />
<br />
</label>
<label>
<input type="submit" name="Submit" value="Enviar" tabindex="10" />
</label>
<input type="reset" name="Submit2" value="Borrar campos" tabindex="10" />
</form>