Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/08/2013, 03:06
Avatar de sven_uri
sven_uri
 
Fecha de Ingreso: mayo-2011
Mensajes: 109
Antigüedad: 12 años, 11 meses
Puntos: 4
Respuesta: Formulario que no inserta texto

Cita:
Iniciado por guardarmicorreo Ver Mensaje
¿y el código?
Disculpas, no queria molestaros con el codigo.

Es el siguiente:

Código PHP:
Ver original
  1. <html>
  2.     <head>
  3.                 <meta charset="utf-8">
  4.         <title>Registro Objetivos</title>
  5.     </head>
  6. <body>
  7.     <form action="obj_registrat.php" method=post name="formulari">
  8.         Objetivo: <input type=text name="nom_obj"></input><br>
  9.         Descripción: <input type=text name="descripcio_obj"></input><br>
  10.         <input type="submit" name="boto_guardar" value="Guardar">
  11.     </form>
  12.  
  13. </body>
  14. <footer>
  15. </footer>
  16.  
  17. </html>

Y el que me hace los inserts:

Código PHP:
Ver original
  1. <?php
  2.     include("conexio.php");
  3. ?>
  4. <?php
  5.     if (isset($_POST['nom_obj']) && !empty($_POST['nom_obj']) &&
  6.     isset($_POST['descripcio_obj']) && !empty($_POST['descripcio_obj']))
  7.     {
  8.        
  9.         $name_obj = trim ($_POST['nom_obj']);
  10.         $descrip_obj = trim($_POST['descripcio_obj']);
  11.        
  12.             mysql_query("INSERT INTO objectius(objectius_nom,objectius_descripcio) values ('$name_obj','$descrip_obj')");
  13.         echo "Guardat satisfactoriament. <br>";
  14.         echo "<a href='form_obj.php'> Ingressar mas objetivos </a><br>";
  15.         echo "<a href='menu.php'> Volver al menu<br> </a>";
  16.     }
  17.     else
  18.     {
  19.         echo "Tienes que escribir algo.";
  20.     }
  21.  
  22. ?>