Ver Mensaje Individual
  #8 (permalink)  
Antiguo 13/03/2013, 17:38
awik
 
Fecha de Ingreso: febrero-2013
Mensajes: 78
Antigüedad: 12 años
Puntos: 0
Respuesta: Error Formulario guarda cada que actualizo pagina

A ya se

mira cambia esto

<button class="submit" type="submit">Guardar</button>

por

<input type="submit" name=Guardar" value=Guardar" style='width:110px; height:30px' >

y borra todo esto



Código PHP:
Ver original
  1. <?
  2. //coneccion a la base de datos
  3. $host = "localhost";
  4. $usuario = "a10128ho_pinka";
  5. $password = "dan809on";
  6. $db = "a10128ho_pinka";
  7.  
  8. $enlace = mysql_connect($host, $usuario, $password);
  9. mysql_select_db($db,$enlace);
  10. // termina la coneccion a la base de datos
  11.  
  12.  
  13.  
  14.  
  15. if(empty($_POST[tours])){
  16.  
  17. $_tours = $_POST[tour];
  18. $_nombre = $_POST[nombre];
  19. $_foto = $_POST[foto];
  20. $_guia = $_POST[guia];
  21. $_email = $_POST[email];
  22. $_testimonios = $_POST[testimonios];
  23. $_fecha = time();
  24. $_fechac = time();
  25.  
  26. $sql = "INSERT INTO testimonio (tours, nombre, foto, guia, email, testimonios, fechates, fechacreada)
  27.  
  28.                     VALUES ('$_tours','$_nombre','$_foto','$_guia','$_email','$_testimonios','$_fecha','$_fechac') ";
  29.  
  30. $sql = mysql_query($sql);
  31. }
  32. else{
  33. }




en el testimonio.php

pones el


Código PHP:
Ver original
  1. <?php
  2. //coneccion a la base de datos
  3. $host = "localhost";
  4. $usuario = "a10128ho_pinka";
  5. $password = "dan809on";
  6. $db = "a10128ho_pinka";
  7.  
  8. $enlace = mysql_connect($host, $usuario, $password);
  9. mysql_select_db($db,$enlace);
  10. // termina la coneccion a la base de datos
  11.  
  12.  
  13.  if($_POST['Guardar'])
  14. {
  15.  
  16.  
  17.  
  18. $_tours = $_POST[tour];
  19. $_nombre = $_POST[nombre];
  20. $_foto = $_POST[foto];
  21. $_guia = $_POST[guia];
  22. $_email = $_POST[email];
  23. $_testimonios = $_POST[testimonios];
  24. $_fecha = time();
  25. $_fechac = time();
  26.  
  27. $sql = "INSERT INTO testimonio (tours, nombre, foto, guia, email, testimonios, fechates, fechacreada)
  28.  
  29.                     VALUES ('$_tours','$_nombre','$_foto','$_guia','$_email','$_testimonios','$_fecha','$_fechac') ";
  30.  
  31. $sql = mysql_query($sql);
  32.  
  33. ?>
  34. <form id="registro"   name="registro" method="post" action="aquilepones el index de tu pagina">
  35. </form>
  36.  
  37. <?php
  38.  
  39. }
  40. ?>

Última edición por awik; 13/03/2013 a las 17:51