Buenas tardes,
Estoy realizando una pequeña aplicación y cuando voy a insertar los valores que se introducen en el formulario en la BBDD no aparecen los valores que yo he introducido, es decir, realiza la inserción pero la realiza mal.
Les adjunto el codigo fuente.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
// Reallitzam la conexi amb el servidor
$conection = mysql_connect("servidor","bbdd","password") or die ("No es pot connectar amb el servidor");
// Es selecciona la BBDD amb la que es treballar.
mysql_select_db("bbdd", $conection);
// Realitzam la consulta
$sql = mysql_query("select * from avisos") or die ('Invalid query: ' . mysql_error());
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" media="screen" rel="stylesheet" rev="stylesheet" href="../imagenes/estilos.css" />
<script type = "text/javascript" src = "scripts/funciones.js"></script>
<title>Avisos</title>
</head>
<body>
<form name = "acre" action = "avisos2.php" method = "post">
<div name="logo">
<img src="../imagenes/aclogo.jpg" alt="logo" width="500" height="122" align="middle" name="log"/>
</div>
<div name = "titol" id = "titul">
<h2> Avisos </h2>
</div>
<div name = "introduccio" id="intro">
<span>
<div id="fe">
<label for="fech"> Fecha </label> <input type="text" name="fecha" size="" maxlength="10" id="fech" class="" onkeypress="return numbarra();" />
</div>
<div id="desc"><label for="descripcio"> Descripción </label><textarea name="descripci" id="descripc" cols="40" rows="5"></textarea></div>
</span>
<span>
<div id="cli">
<label for="client"> Cliente </label> <input type="text" name="clien" id="clie" maxlength="50" onkeypress="return letras();" class="" />
</div>
<div id="fecgast"><label for="fecgastges"> Fecgastgest </label> <input type="text" name="fecgast" id="fecgas" maxlength="10" onkeypress="return numbarra();" class=""/></div>
</span>
</div>
<span>
<div name = "boto" id="botons">
<button onclick="enviar();">
<img src="../imagenes/insertar.jpg" width="50" height="50" alt="insetar nuevos registros"/>
</button>
<button onclick="reset();">
<img src='../imagenes/papelera.jpg' width ="50" height ="50" alt="Limpiar formulario"/>
</button>
</div>
</span>
</form>
</body>
<?
mysql_close($conection);
?>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
// Reallitzam la conexi amb el servidor
$conection = mysql_connect("servidor","bbdd","password") or die ("No es pot connectar amb el servidor");
// Es selecciona la BBDD amb la que es treballar.
mysql_select_db("bbdd", $conection);
// Realitzam la consulta
/*$sql = mysql_query("select * from av") or die ('Invalid query: ' . mysql_error()); */
$fec=$_POST['fecha'];
mysql_query("insert into avisos (fecha) values ('$fec')",$conection);
mysql_close($conection);
?>
<script> window.close(); </script>
Alguien me puede decir el porque ?
Gracias.