Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/03/2004, 02:20
chari
 
Fecha de Ingreso: diciembre-2002
Mensajes: 130
Antigüedad: 21 años, 4 meses
Puntos: 0
Pq Me Falla El Codigo?

EL CODIGO ES EL SIGUIENTE, SOLO PONGO EL FORMULARIO QUE ES LO QUE CREO QUE ME FALLA.

EL PROBLEMA QUE TENGO ES EL SIGUIENTE INTENTO INSERTAR DATOS EN UNA BASE DE DATOS, YO LE METO LOS DATOS Y PULSO EN GUARDAR, Y LO QUE ME CREA ES UN NUEVO REGISTRO EN LA BASE DE DATOS PERO EN BLANCO.

EN LA PAGINA INSERTAR.PHP HE PUESTO UN ECHO DE CADA VARIABLE Y SIEMPRE ME LAS IMPRIME EN BLANCO.

PAGINA.PHP

<form name="fcalen" method="post" action="insertar.php">
<table width="74%" border="0">
<tr>
<td height="28">FECHA</td>
<td width="56%">
<?
escribe_formulario_fecha_vacio("fecha1","fcalen");
?>
</td>
</tr>
<tr>
<td height="28">PROYECTO</td>
<td><select name="proyecto" size="1">
<?
$listanombre = mysql_query("select * from PROYECTOS order by NOMBRE");
$row = mysql_fetch_array($listanombre);
while($row){
$nomlista = $row["NOMBRE"];
print "<option value=\"$nomlista\" SELECTED>" . $row["NOMBRE"] . "</option>";
$row = mysql_fetch_array($listanombre);
}
?>
</select></td>
</tr>
<tr>
<td height="28">HORAS</td>
<td><input name="horas" type="text" id="horas"></td>
</tr>
<tr>
<td height="28">COMENTARIO</td>
<td><input name="comentario" type="text" id="comentario"></td>
</tr>
<tr>
<td height="57"><b onClick="window.open('horas.php','','width=600,hei ght=225,scrollbars=yes')"><a href="#"><img src="../boton_horas.gif" alt="Horas" width="25" height="25" hspace="10" border="0"></a></b><b onClick="window.open('prueba.php','','width=600,he ight=225,scrollbars=yes')"></b><b onClick="window.open('prueba2.php','','width=600,h eight=225,scrollbars=yes')"></b><b onClick="window.open('prueba2.php','','width=600,h eight=225,scrollbars=yes')"></b></td>
<td><input type="Submit" name="enviar" value="Guardar">
<input type="reset" name="Submit" value="Borrar">
<b onClick="window.open('prueba.php','','width=600,he ight=225,scrollbars=yes')"><a href="#">
<img src="../boton_proyectos.gif" alt="Todos los Proyectos" width="77" height="18" hspace="10" border="0"></a></b><b onClick="window.open('prueba2.php','','width=600,h eight=225,scrollbars=yes')"><a href="#"><img src="../boton_vigentes.gif" alt="Proyectos Vigentes" width="77" height="18" hspace="10" border="0"></a></b></td>
</tr>
</table>
</form>


INSERTAR.PHP

<?
include_once ("../auth.php");
include_once ("../authconfig.php");
include_once ("../check.php");

$connection = mysql_connect($dbhost, $dbusername, $dbpass);
$SelectedDB = mysql_select_db($dbname);

$codigo = $check["CODIGO"];
echo $codigo;
echo $fecha1;
echo $proyecto;
echo $horas;
echo $comentario;

?>
<html>
<head>
<title>Proyectos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
$sql = "INSERT INTO HORAS (PERSONA, FECHA, PROYECTO, HORAS, COMENTARIO, COSTE) VALUES ('$codigo', '$fecha1', '$proyecto', '$horas', '$comentario', '$coste')";
$result = mysql_query($sql);
echo "Sus datos han sido introducidos.\n";
echo "<a href=horas2.php>volver</a>";

?>
</body>
</html>

SALUDOS. GRACIAS