elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web (Moderador: #!drvy)
| | |-+  Formulario PHP y resultados
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Formulario PHP y resultados  (Leído 1,804 veces)
datab

Desconectado Desconectado

Mensajes: 45


Ver Perfil
Formulario PHP y resultados
« en: 18 Abril 2015, 08:43 am »

Buenas tardes tengo un formulario en http://banquita.site40.net/venta.php, cuyo codigo es
Código
  1. <script src="funciones.js" language="javascript"></script>
  2.   <script src="funciones2.js" language="javascript"></script>
  3.   <script src="funciones.js" language="javascript"></script>
  4.   <script src="jquery.min.js" language="javascript"></script>
  5.    <script src="ajax.js" language="javascript"></script>
  6. <script language="javascript" src="jquery-1.3.min.js"></script>
  7. <script language="javascript">
  8. $(document).ready(function() {
  9.    $().ajaxStart(function() {
  10.        $('#loading').show();
  11.        $('#result').hide();
  12.    }).ajaxStop(function() {
  13.        $('#loading').hide();
  14.        $('#result').fadeIn('slow');
  15.    });
  16.    $('#form, #fat, #detalleventas').submit(function() {
  17.        $.ajax({
  18.            type: 'POST',
  19.            url: $(this).attr('action'),
  20.            data: $(this).serialize(),
  21.            success: function(data) {
  22.                $('#result').html(data);
  23.  
  24.            }
  25.        })
  26.  
  27.        return false;
  28.    });
  29. })  
  30. </script>
  31.  
  32.  
  33. <form name="ventas" action="validaventa.php" method="post" autocomplete="off">
  34.  
  35. Sorteo:
  36.  <select name="Sorteo" id="sorteo" type="text">
  37.  <option value="<?php echo date("d/m/Y"); ?>" selected="selected"><?php echo date("d/m/Y"); ?></option>
  38.  <option value="<?php echo date("d/m/Y",strtotime("+1 day")); ?>"><?php echo date("d/m/Y",strtotime("+1 day")); ?></option>
  39.  <option value="<?php echo date("d/m/Y",strtotime("+2 day")); ?>"><?php echo date("d/m/Y",strtotime("+2 day")); ?></option>
  40.  <option value="<?php echo date("d/m/Y",strtotime("+3 day")); ?>"><?php echo date("d/m/Y",strtotime("+3 day")); ?></option>
  41.  <option value="<?php echo date("d/m/Y",strtotime("+4 day")); ?>"><?php echo date("d/m/Y",strtotime("+4 day")); ?></option>
  42.  <option value="<?php echo date("d/m/Y",strtotime("+5 day")); ?>"><?php echo date("d/m/Y",strtotime("+5 day")); ?></option>
  43.  <option value="<?php echo date("d/m/Y",strtotime("+6 day")); ?>"><?php echo date("d/m/Y",strtotime("+6 day")); ?></option>
  44.  </select>
  45.  
  46. Tipo:
  47.  <select name="Tipo" id="tipo">
  48.  <option value="<?php $h=date("H");
  49. if ($h>12)
  50.  echo "NOCHE"  ;
  51.  else echo "MEDIODIA"
  52. ?>" selected="selected" type="text">
  53. <?php $h=date("H");
  54. if ($h>12)
  55.  echo "NOCHE"  ;
  56.  else echo "MEDIODIA"
  57. ?></option>
  58.  <option value="<?php $h=date("H");
  59. if ($h>12)
  60.  echo "MEDIODIA"  ;
  61.  else echo "NOCHE"
  62. ?>" type="text"><?php $h=date("H");
  63. if ($h>12)
  64.  echo "MEDIODIA"  ;
  65.  else echo "NOCHE"
  66. ?> </option>
  67.  
  68.  </select>
  69.  
  70. Numero: <input autofocus maxlength="2" name="numero" id="numero" type="text" size="2" style="text-align:right" onKeyup="autotab(this, document.ventas.monto)" maxlength="2" align="right" autofocus>
  71.  
  72.  
  73. Monto: <input maxlength="5" name="monto" id="monto" type="text" size="5" style="text-align:right" maxlength="5" align="right">
  74.  
  75. <input type="hidden" name="compra" id="compra" value="<?php echo date("d/m/Y"); ?>">
  76. <input type="hidden" name="hora" id="hora" value="<?php echo date("H:i:s")?>">
  77. <input type="hidden" name="tiquete" id="tiquete" value="<?php echo "nod" ?>">
  78. <input type="hidden" name="estado" id="estado" value="SIN PREMIO/POR REVERSAR">
  79. <input type="hidden" name="usuario" id="usuario" value="<?php echo strtoupper($_SESSION['usuario']); ?>">
  80.  
  81. <input type="submit" name="button" id="button" value="Incluir" />
  82. </form>
  83.  
  84. <div id="detalleventas"></div>
  85.  
  86.  


quiero que al ingresar datos estos aparezcan abajo en el div ventaresultados, y el formulario no se recargue para ingresar mas datos, y que sigan apareciendo, sim embargo cuando se da enter aparecen se recarga toda la pagina y aparecen solo los dato ingresados.
que puedo hacer

Gracias


En línea

peib0l
Wiki

Desconectado Desconectado

Mensajes: 3.493


freedom


Ver Perfil WWW
Re: Formulario PHP y resultados
« Respuesta #1 en: 18 Abril 2015, 10:07 am »

quita el action="validaventa.php"  y pon dos botones, uno de agregar producto y otro de finalizar


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Guardar Resultados de un formulario en directorio « 1 2 »
Programación Visual Basic
Hack-11 12 4,935 Último mensaje 8 Julio 2011, 22:26 pm
por raul338
Formulario PHP y resultados
PHP
datab 3 2,044 Último mensaje 11 Abril 2015, 11:44 am
por venadHD
Formulario PHP y resultados
Desarrollo Web
datab 3 1,918 Último mensaje 4 Mayo 2015, 09:25 am
por engel lex
HTML y PHP : Formulario de seleccion de listas que muestra resultados.
Desarrollo Web
Citrusl 1 2,121 Último mensaje 17 Mayo 2015, 02:12 am
por EFEX
Ayuda enviar resultados formulario de una web a un script Python
Scripting
Orizzon 2 2,922 Último mensaje 25 Agosto 2017, 22:07 pm
por Orizzon
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines