Ver Mensaje Individual
  #6 (permalink)  
Antiguo 07/12/2012, 18:31
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 17 años, 8 meses
Puntos: 1567
Respuesta: ejecutar 2 submit, solo me hace 1

La clave pasa como te ha dicho @caricatos en utilizar diferentes targets.
También tenés que evitar el submit natural de un form que realiza un input type='submit' ó un <button>enviar</button>, quedando como alternativa un input type="button" con un evento onclik. Luego creo que es más prolijo si integrás todo en una función, podés pasar a 2, 3 ó mas páginas definiendo diferentes actions y que cada una reciba solo los datos que correspondan

Ejemplo

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
  4. <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  5. <title>Multiple submit</title>
  6.  
  7. <script type='text/javascript'>
  8. //<![CDATA[
  9.  
  10. function EnviarForm(){
  11.    
  12.        document.forms['contacto'].action='action1.php';
  13.        document.forms['contacto'].target='resultado1';
  14.        document.forms['contacto'].submit();
  15.  
  16.        document.forms['contacto'].action='action2.php';
  17.        document.forms['contacto'].target='resultado2';
  18.        document.forms['contacto'].submit();
  19.  
  20.        document.forms['contacto'].action='action3.php';
  21.        document.forms['contacto'].target='resultado3';
  22.        document.forms['contacto'].submit();
  23.  
  24.    return true;
  25. }
  26. //]]>
  27. </head>
  28. <form id='contacto' action='#' method='post' name="contacto">
  29. <fieldset><legend>Multiple submit</legend> <label for='nombre'>Nombre:</label><br />
  30. <input type='text' name='nombre' id='nombre' maxlength="50" /><br />
  31. <label for='email'>Email</label><br />
  32. <input type='text' name='email' id='email' maxlength="50" /><br />
  33. <label for='telefono'>Teléfono:</label><br />
  34. <input type='text' name='telefono' id='telefono' maxlength="15" /><br />
  35. <input type='button' name='procesar' value='procesar' onclick='return EnviarForm();' /></fieldset>
  36. </form>
  37. <iframe name='resultado1' id="resultado1" width="200" height="200"></iframe> <iframe name='resultado2' id="resultado2" width='200' height='200' src="about:blank"></iframe> <iframe name='resultado3'
  38. id="resultado3" width='200' height='200' src="about:blank"></iframe>
  39. </body>
  40. </html>

tus action1.php, action2.php y action3.php serían

Código PHP:
Ver original
  1. <?php
  2. echo "Nombre: " . $_POST['nombre'];
  3. ?>
Código PHP:
Ver original
  1. <?php
  2. echo "Email: " . $_POST['email'];
  3. ?>
Código PHP:
Ver original
  1. <?php
  2. echo "Telefono: " . $_POST['telefono'];
  3. ?>

Demo
http://foros.emprear.com/html/multi-submit/


igual quizás puedas hacer todo desde el mismo php
Salu2
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.