A ver si alguien me aclara la cabeza.
Tengo el codigo y me funciona a medias.
en una misma pagina tengo dos formularios con select submit, el primero me lo ejecuta bien, pero el segundo no.
Este es el codigo:
Código PHP:
Ver original
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>Documento sin título</title> </head> <body> <?php $first_name = $_POST['nombre']; $last_name = $_POST['apellido']; $address = $_POST['address']; $pickup_city = $_POST['pickup_city']; $pickup_state = $_POST['pickup_state']; $pickup_zip_code = $_POST['pickup_zip_code']; $phone = $_POST['phone']; ?> <form id="form1" name="form1" method="post" action="pickup.php"> <select name="datos" id="datos" onchange="this.form.submit();"> <option value="">select one</option> <option value="10663">Client</option> <option value="1">Trailer Bridge Jack.</option> <option value="2">Trailer Bridge PR.</option> <option value="3">Crowley NJ.</option> <option value="4">Crowley PR.</option> <option value="5">Sea Star Line Jack.</option> <option value="6">Sea Star Line PR.</option> <option value="7">Sea Star Line EV.</option> </select> <br /> <br />Pickup Contact<br /> <br /> Terminal :<input name="first_name" type="text" id="first_name" value="<?php echo $first_name ?>" /> <br /> Contact :<input name="last_name" type="text" id="last_name" value="<?php echo $last_name ?>" /> <br /> Buyer Number :<input name="buyer_number" type="text" id="buyer_number" value="" /> <br /> Address :<input name="address" type="text" id="address" value="<?php echo $address ?>" /> <br /> Pickup :<input name="pickup_city" type="text" id="pickup_city" value="<?php echo $pickup_city ?>" /> <input name="pickup_state_code" type="text" id="pickup_state_code" value="<?php echo $pickup_state_code ?>" size="3" /> <input name="pickup_zip_code" type="text" id="pickup_zip_code" value="<?php echo $pickup_zip_code ?>" size="6" /> Phone: <input name="phone" type="text" id="phone" value="<?php echo $phone ?>" /> <br /> </fom> <br /> <?php $first_name_dropoff = $_POST['nombre_dropoff']; $last_name_dropoff = $_POST['apellido_dropoff']; $address_dropoff = $_POST['address_dropoff']; $dropoff_city = $_POST['dropoff_city']; $dropoff_state = $_POST['dropoff_state']; $dropoff_zip_code = $_POST['dropoff_zip_code']; $phone_dropoff = $_POST['phone_dropoff']; ?> <form id="form2" name="form2" method="post" action="dropoff.php"> <select name="datos2" id="datos2" onchange="this.form.submit();"> <option value="">select one</option> <option value="10663">Client</option> <option value="1">Trailer Bridge Jack.</option> <option value="2">Trailer Bridge PR.</option> <option value="3">Crowley NJ.</option> <option value="4">Crowley PR.</option> <option value="5">Sea Star Line Jack.</option> <option value="6">Sea Star Line PR.</option> <option value="7">Sea Star Line EV.</option> </select> <br /> </br />Delivery Contact<br /> <br /> Terminal :<input name="first_name_dropoff" type="text" id="first_name_dropoff" value="<?php echo $first_name_dropoff ?>" /> <br /> Contact :<input name="last_name_dropoff" type="text" id="last_name_dropoff" value="<?php echo $last_name_dropoff ?>" /> <br /> Buyer Number :<input name="buyer_number" type="text" id="buyer_number" value="" /> <br /> Address :<input name="address_dropoff" type="text" id="address_dropoff" value="<?php echo $address_dropoff ?>" /> <br /> Pickup :<input name="dropoff_city" type="text" id="dropoff_city" value="<?php echo $dropoff_city ?>" /> <input name="dropoff_state_code" type="text" id="dropoff_state_code" value="<?php echo $dropoff_state_code ?>" size="3" /> <input name="dropoff_zip_code" type="text" id="dropoff_zip_code" value="<?php echo $dropoff_zip_code ?>" size="6" /> Phone: <input name="phone_dropoff" type="text" id="phone_dropoff" value="<?php echo $phone_dropoff ?>" /> <br /> </fom> </body> </html>
cada formulario llama otro php que ejecuta la peticion:
Código PHP:
Ver original
<?php $cliente = $_POST['datos']; //1. Crear conexión a la Base de Datos if (!$conexion) { } //2. Seleccionar la Base de Datos a utilizar if (!$seleccionar_bd) { } { echo' <form name="auxiliar" id="auxiliar" method="post" action="order.php"> <input type="hidden" name="nombre" value="'.$fila['first_name'].'" /> <input type="hidden" name="apellido" value="'.$fila['last_name'].'" /> <input type="hidden" name="address" value="'.$fila['address'].'" /> <input type="hidden" name="pickup_city" value="'.$fila['pickup_city'].'" /> <input type="hidden" name="pickup_state_code" value="'.$fila['pickup_state_code'].'" /> <input type="hidden" name="pickup_zip_code" value="'.$fila['pickup_zip_code'].'" /> <input type="hidden" name="phone" value="'.$fila['phone'].'" /> </form> <script type="text/javascript"> document.auxiliar.submit(); </script> '; } ?>
el segundo codigo al que llama es:
Código PHP:
Ver original
<?php $cliente = $_POST['datos2']; //1. Crear conexión a la Base de Datos if (!$conexion) { } //2. Seleccionar la Base de Datos a utilizar if (!$seleccionar_bd) { } { echo' <form name="auxiliar" id="auxiliar" method="post" action="order.php"> <input type="hidden" name="nombre_dropoff" value="'.$fila['first_name'].'" /> <input type="hidden" name="apellido_dropoff" value="'.$fila['last_name'].'" /> <input type="hidden" name="address_dropoff" value="'.$fila['address'].'" /> <input type="hidden" name="dropoff_city" value="'.$fila['dropoff_city'].'" /> <input type="hidden" name="dropoff_state_code" value="'.$fila['dropoff_state_code'].'" /> <input type="hidden" name="dropoff_zip_code" value="'.$fila['dropoff_zip_code'].'" /> <input type="hidden" name="phone_dropoff" value="'.$fila['phone'].'" /> </form> <script type="text/javascript"> document.auxiliar.submit(); </script> '; } ?>
al hacer el onchange del primero me carga los datos correctamente, pero al hacer el onchange del segundo me vuelve a ejecutar el primero.
Desde ya muchas gracias por el tiempo prestado