Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/07/2011, 18:50
Avatar de PabloPF
PabloPF
 
Fecha de Ingreso: mayo-2011
Ubicación: Ciudadano de un lugar llamado mundo!
Mensajes: 137
Antigüedad: 13 años
Puntos: 5
Pregunta Problema al insertar en db

Hola, tengo este codigo:
Código PHP:
Ver original
  1. <?php
  2. $http="blog";
  3. include("../includes/conexion.php");
  4. include("../includes/contador.php");
  5. getBrowser();
  6. if($ip!="X.x.x.x"){
  7. echo '<meta http-equiv="Refresh" content="0;url=http://x.x.com">';
  8. }
  9. else{
  10.     if(isset($_POST['enviar']))//Vallidamos que el formulario fue enviado
  11. {
  12.     $_POST['title']=$title;
  13.     $_POST['date']=$date;
  14.     $_POST['content']=$content;
  15.     $_POST['mes']=$mes;
  16.  
  17. mysql_query("INSERT INTO db SET title='$title',mes='$mes',date='$date',content='$content'");
  18. }
  19. ?>
  20. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  21. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
  22. <head>
  23. <meta name="robots" content="NOINDEX ,NOFOLLOW ,NOARCHIVE" />
  24. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  25. <title>Añadir entradas al blog de manager de primera</title>
  26. </head><body><div style="text-align: center;">
  27. <form name="enviar" action="add" method="post" />
  28.         <input type='text' name='title' value="Título"  onfocus="if (this.value == 'Título') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Título';}" /><br /><br />
  29.  
  30.         <input type="text" name="mes" value="Mes"  onfocus="if (this.value == 'Mes') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Mes';}" /><br /><br />
  31.  
  32.  
  33.         <input type="text" name="date" value="Fecha"  onfocus="if (this.value == 'Fecha') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Fecha';}" /><br /><br />
  34.        
  35.                 <textarea name="content"></textarea><br /><br />
  36.                         <input type="submit" name="enviar" style="width:100px;" tabindex="6" value="add" />
  37.  
  38.     </form>
  39.    
  40.     </div>
  41. </body>
  42. </html>
  43. <?php }?>
Y el problema es que en la base de datos me aparecen los campos en blanco, ¿que está mal? gracias.
__________________
no hay justicia si la guerra esta justificada

Última edición por cvander; 31/07/2011 a las 15:53