Campos desorganizados.
Publicado por Caruso (27 intervenciones) el 08/12/2013 11:42:02
Bueno llevo un tiempo buscando en el codigo y ya me rindo.
El caso es que me dice "complete todos los campos". El codigo es el siguiente
Este es el formulario para agregar un user pero el problema esta aca:
Parece ser que falta un campo pero no lo encuentro. Muchas gracias.
El caso es que me dice "complete todos los campos". El codigo es el siguiente
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<html>
<head>
<title>Sistema de gestion de usuarios</title>
</head>
<body>
<table align="center" width="60%">
<tr>
<td>
<form name="registro" action="agregar.php" method="post">
<fieldset>
<legend>Cuenta de usuario</legend>
<table align="center" cellpadding="6">
<tr>
<td><p>Nombre de usuario</p></td>
<td><input type="text" value="" name="User"/></td>
</tr>
<tr>
<td><p>Contraseña</p></td>
<td><input type="password" value="" name="Pass"/></td>
</tr>
<tr>
<td><p>Tipo de usuario</p></td>
<td><select name="TipoUser">
<option value="1">Normal</option>
<option value="2">Administrador</option>
</select>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Login de datos personales</legend>
<table align="center" cellpadding="6">
<tr>
<td><p>Documento</p></td>
<td><input type="text" value="" name="NumeroD"/></td>
<td><p align="right">Tipo</p></td>
<td><select name="TipoD">
<option value="1">DNI</option>
<option value="2">CUIT</option>
</select></td>
</tr>
<tr>
<td><p>Apellido</p></td>
<td><input type="text" value="" name="Apellido"/></td>
</tr>
<tr>
<td><p>Nombres</p></td>
<td><input type="text" value="" name="Nombre"/></td>
</tr>
<tr>
<td><p>Sexo</p></td>
<td><select name="Sexo">
<option value="F">Femenino</option>
<option value="M">Masculino</option>
</select></td>
<td><p>Fecha de Nacimiento</p></td>
<td><input type="text" value="" name="FechaNaci"/></td>
</tr>
<tr>
<td><p>Direccion</p></td>
<td><input type="text" value="" name="Direccion"/></td>
</tr>
<tr>
<td><p>Provincia</p></td>
<td><select name="Provincia">
<option value="Entre Rios">Entre Rios</option>
<option value="Santa Fe">Santa Fe</option>
</select></td>
<td><p>Localidad</p></td>
<td><input type="text" value="" name="Localidad"/></td>
</tr>
<tr>
<td><p>Pais</p></td>
<td><input type="text" value="" name="pais"/></td>
</tr>
</table>
</fieldset>
<fieldset>
<table align="center">
<legend>Datos de contacto</legend>
<tr>
<td><p>Telefono</p></td>
<td><input type="text" value="" name="Tel"/></td>
</tr>
<tr>
<td><p>Telefono Movil</p></td>
<td><input type="text" value="" name="Movil"/></td>
</tr>
<tr>
<td><p>Email</p></td>
<td><input type="text" value="" name="Email"/></td>
</tr>
</table>
</fieldset>
<fieldset>
<table align="center" cellpadding="6">
<tr>
<td><input type="reset" value="Borrar" name="borrar"/>
<input type="submit" value="Enviar" name="guardar datos"/>
</td>
</tr>
</table>
</fieldset>
</form>
</td>
</tr>
</table>
</body>
</html>
Este es el formulario para agregar un user pero el problema esta aca:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
include ("../../includes/php/conexion.php");
function ValidarCampos(){
$datos=true;
foreach ($_POST as $key=>$valor){
if ($valor==""){
$datos=false;
}
}
return $datos;
}
if (!empty ($_POST['Enviar'])){
$completo=validarcampos();
if ($completo==true){
$tipo_documento =$_POST['TipoD'];
$nro_documento =$_POST['NumeroD'];
$apellido =$_POST['Apellido'];
$nombres =$_POST['Nombre'];
$fechaNac =$_POST['FechaNaci'];
$sexo =$_POST['Sexo'];
$movil =$_POST['Movil'];
$tel =$_POST['Tel'];
$domicilio =$_POST['Direccion'];
$email =$_POST['Email'];
$provincia =$_POST['Provincia'];
$localidad =$_POST['Localidad'];
$pais =$_POST['pais'];
$tipo =$_POST['TipoUser'];
$username =$_POST['User'];
$password =$_POST['Pass'];
$query="INSERT INTO sgp.personas (idTipoDocumento,numeroDocumento,apellido,nombres,fechaNacimiento,sexo,telefonoMovil,";
$query.=" telefono,email,domicilio,provincia,localidad,pais) values";
$query.=" ('$tipo_documento','$nro_documento','$apellido', '$nombres', '$fechaNac','$sexo',";
$query.=" '$movil', '$tel','$email','$domicilio','$provincia','$localidad','$pais')";
$con=conectarDB();
mysql_select_db("sgp",$con);
$SQL=mysql_query($query,$con);
$idinsertado=mysql_insert_id($con);
$query2="INSERT INTO sgp.usuarios (idPersona,idTipoUsuario,username,password,habilitado)";
$query2.=" values ('$idinsertado','$tipo','$username','$password','s')";
mysql_query($query2,$con) or die (mysql_error());
}
$msj="usted se registro";
}else{
$msj="complete todos los campos";
}
?>
<?php include ("../../includes/php/header.php") ?>
<html>
<head>
<meta charset="UTF-8"/>
<title>Listo</title>
</head>
<body>
<table align="center">
<tr>
<td>
<?php echo $msj ?>
</td>
</tr>
</table>
</form>
</body>
<?php include ("../../includes/php/footer.php") ?>
</html>
Parece ser que falta un campo pero no lo encuentro. Muchas gracias.
Valora esta pregunta
0