codigo php
Publicado por carlos (27 intervenciones) el 15/11/2016 19:18:37

tengo problemas con el código php al momento de mandato en método post
Aquí está el codigo html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>nuevo registro</title>
</head>
<body>
<center><h1>nuevo</h1></center>
<form name="nuevo" method="POST" action="guardar.php">
<table width="61%">
<tr>
<td width="40%"><div align="center"><b>codigo</b></div></td>
<td width="60%">
<div align="left">
<input type= "txt" name="codigo" size="25"/>
</div></td>
</tr>
<tr>
<td width="40%"><div align="center"><b>nombre</b></div></td>
<td width="60%">
<div align="left">
<input type= "txt" name="nombre" size="25"/>
</div></td>
</tr>
<tr>
<td width="40%"><div align="center"><b>apellido</b></div></td>
<td width="60%">
<div align="left">
<input type= "txt" name="apellido" size="25"/>
</div></td>
</tr>
<tr>
<td width="40%"><div align="center"><b>carrera</b></div></td>
<td width="60%">
<div align="left">
<input type= "txt" name="carrera" size="25"/>
</div></td>
</tr>
<tr>
<td width="40%"><div align="center"><b>decanato</b></div></td>
<td width="60%">
<div align="left">
<input type= "txt" name="decanato" size="25"/>
</div></td>
</tr>
<td width="40%"><div align="center"><b>motivo</b></div></td>
<td width="60%">
<div align="left">
<input type= "txt" name="motivo" size="25"/>
</div></td>
</tr>
<td width="40%"><div align="center"><b>fecha_de_prestamo</b></div></td>
<td width="60%">
<div align="left">
<input type= "data" name="fecha_de_prestamo" size="25"/>
</div></td>
</tr>
<td width="40%"><div align="center"><b>fecha_de_debolucion</b></div></td>
<td width="60%">
<div align="left">
<input type= "data" name="fecha_de_debolucion" size="25"/>
</div></td>
</tr>
<tr>
<td colspan="2"> <center> <input type="submit" name="guargar" value="registra"/></center></td>
</div></td></tr>
</table>
</form>
</body>
</html>
Código php
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
<?PHP
require('conexion.php');
$codigo=$_POST['codigo'];
$nombre=$_POST['nombre'];
$apellido=$_POST['apellido'];
$carrera=$_POST['carrera'];
$decanato=$_POST['decanato'];
$motivo=$_POST['motivo'];
$fecha_de_prestamo=$_POST['fecha_de_prestamo'];
$fecha_de_debolucion=$_POST['fecha_de_debolucion'];
$query="INSER INTO alumno(codigo, nombrealumno, apellidoalumno, carrera, facultad_departamento, motivoprestamo, fechacprestamo, fechadebulucion) VALUES ('$codigo' '$nombre','$apellido','$carrera','$decanato','$motivo','$fecha_de_prestamo', '$fecha_de_debolucion')";
$resultado=$mysqli->query($query);
?>
<html>
<head>
<title>guardar reistro</title>
</head>
<body>
<center>
<?php if($resultado>0){?>
<h1>registro guardado</h1>
<?php }else{ ?>
<h1> erro al registro guardado</h1>
<?php } ?>
<p> </p>
<a href="index.html">regresar </a>
</center>
</body>
</html>
Al ejecutarlo me dise que no se giardo
Valora esta pregunta


0