Foros del Web » Programando para Internet » PHP »

Realizar submit sin enviar

Estas en el tema de Realizar submit sin enviar en el foro de PHP en Foros del Web. Hola a todos...como puedo realizar un submit en un combobox, sin enviar nada...y solo enviar hasta que oprima el botón enviar. A ver aclaro mas ...
  #1 (permalink)  
Antiguo 21/11/2007, 19:04
 
Fecha de Ingreso: junio-2002
Mensajes: 261
Antigüedad: 21 años, 10 meses
Puntos: 0
Realizar submit sin enviar

Hola a todos...como puedo realizar un submit en un combobox, sin enviar nada...y solo enviar hasta que oprima el botón enviar. A ver aclaro mas la situación: poseo unos combox los cuales estan enlazados a la info de manera dinámica, si selecciono el código, me muestra en el otro la empresa y así sucesivamente actualizo cada a través de un onClick="submit()", pero el dato seleccionado del último combo debo tomarlo y pasarlo como variable de formulario a otra página PHP, por lo tanto incluí un botón y al formulario le dije que su acción era ir a la pantalla tal...pero ahora q selecciono algo en cualquier combo, el primero en el cual haga click...automaticamente me envia a la siguietne página y como no lleva el valor de trabajo.

Tonces...la pregunta es como poder usar ese submit en los combox y q solo se pase a la sigueitne página cuando le de click al botón enviar y pasar mi dato a la página requerida?

Gracias
__________________
Buscando el camino...
  #2 (permalink)  
Antiguo 21/11/2007, 19:36
Avatar de eits  
Fecha de Ingreso: junio-2005
Ubicación: valladolid, yucatán
Mensajes: 1.655
Antigüedad: 18 años, 10 meses
Puntos: 88
Re: Realizar submit sin enviar

utiliza dos formulario
ejemplo:
Código HTML:
<form name="uno" action="sig_pag" method="post">
<!-- ...datos del formulario que se muestra-->
<select name="combo" onChange="document.forms['dos'].valor_para_combo.value=this.value;document.forms['dos'].submit();">
<option value="valor">valor</option>
<!--... lo demas-->
</select>
<input type="submit" value="enviar">
</form>

form name="dos" action="pag_que_llena_combo" method="post">
<input type="hidden" name="valor_para_combo">
</form> 
con esto logras que cada vez que cambie el valor del combo envias los datos necesarios para llenar el siguiente combo y no afectas el primer form.

espero que esto te de una idea, sin código no puedo hacer mas.
suerte y saludos.
__________________
El amor es la locura mas lucida que tiene el hombre.- Andres Henestrosa
la tristeza no existe, solo es... la ausencia de la felicidad.
  #3 (permalink)  
Antiguo 21/11/2007, 20:26
 
Fecha de Ingreso: junio-2002
Mensajes: 261
Antigüedad: 21 años, 10 meses
Puntos: 0
Re: Realizar submit sin enviar

Hola Eits...realice lo q me dijiste pero no funciona ya que el campo q deseo enviar se encuentra en el primer formulario, y cuando pongo el segundo formulario, envia este y no los datos del primero, como podría corregir eso para enviar el dato, haciendo el submit en el formulario 2...Gracias
__________________
Buscando el camino...
  #4 (permalink)  
Antiguo 22/11/2007, 00:42
Avatar de jorgedx  
Fecha de Ingreso: junio-2005
Ubicación: Chile, Los Andes
Mensajes: 406
Antigüedad: 18 años, 10 meses
Puntos: 4
Re: Realizar submit sin enviar

podrias mostrar tu codigo para ayudarte y ver tu problemas mas claramente???
__________________
Nuevamente a las pistas ...
  #5 (permalink)  
Antiguo 22/11/2007, 08:17
 
Fecha de Ingreso: junio-2002
Mensajes: 261
Antigüedad: 21 años, 10 meses
Puntos: 0
Re: Realizar submit sin enviar

Akí les va todo el code de la page::


<?php require_once('Connections/Audito.php'); ?>
<?php

$colname_RecEmpresa = "-1";
if (isset($_POST['codigo'])) {
$colname_RecEmpresa = (get_magic_quotes_gpc()) ? $_POST['codigo'] : addslashes($_POST['codigo']);
}
mysql_select_db($database_Audito, $Audito);
$query_RecEmpresa = sprintf("SELECT empresa FROM auditoria WHERE cod_usuario = %s ORDER BY empresa ASC", GetSQLValueString($colname_RecEmpresa, "int"));
$RecEmpresa = mysql_query($query_RecEmpresa, $Audito) or die(mysql_error());
$row_RecEmpresa = mysql_fetch_assoc($RecEmpresa);
$totalRows_RecEmpresa = mysql_num_rows($RecEmpresa);

$colname_RecSoftware = "-1";
if (isset($_POST['empresa'])) {
$colname_RecSoftware = (get_magic_quotes_gpc()) ? $_POST['empresa'] : addslashes($_POST['empresa']);
}
$colname2_RecSoftware = "-1";
if (isset($_POST['codigo'])) {
$colname2_RecSoftware = (get_magic_quotes_gpc()) ? $_POST['codigo'] : addslashes($_POST['codigo']);
}
mysql_select_db($database_Audito, $Audito);
$query_RecSoftware = sprintf("SELECT software FROM auditoria WHERE empresa = %s AND cod_usuario = %s ORDER BY software ASC", GetSQLValueString($colname_RecSoftware, "text"),GetSQLValueString($colname2_RecSoftwar e, "int"));
$RecSoftware = mysql_query($query_RecSoftware, $Audito) or die(mysql_error());
$row_RecSoftware = mysql_fetch_assoc($RecSoftware);
$totalRows_RecSoftware = mysql_num_rows($RecSoftware);

$colname_RecFechas = "-1";
if (isset($_POST['software'])) {
$colname_RecFechas = (get_magic_quotes_gpc()) ? $_POST['software'] : addslashes($_POST['software']);
}
$colname2_RecFechas = "-1";
if (isset($_POST['codigo'])) {
$colname2_RecFechas = (get_magic_quotes_gpc()) ? $_POST['codigo'] : addslashes($_POST['codigo']);
}
$colname3_RecFechas = "-1";
if (isset($_POST['empresa'])) {
$colname3_RecFechas = (get_magic_quotes_gpc()) ? $_POST['empresa'] : addslashes($_POST['empresa']);
}
mysql_select_db($database_Audito, $Audito);
$query_RecFechas = sprintf("SELECT fecha FROM auditoria WHERE empresa = %s AND cod_usuario = %s AND software = %s ORDER BY fecha ASC", GetSQLValueString($colname3_RecFechas, "text"),GetSQLValueString($colname2_RecFechas, "int"),GetSQLValueString($colname_RecFechas, "text"));
$RecFechas = mysql_query($query_RecFechas, $Audito) or die(mysql_error());
$row_RecFechas = mysql_fetch_assoc($RecFechas);
$totalRows_RecFechas = mysql_num_rows($RecFechas);

$colname_RecNumAudito = "-1";
if (isset($_POST['fecha'])) {
$colname_RecNumAudito = (get_magic_quotes_gpc()) ? $_POST['fecha'] : addslashes($_POST['fecha']);
}
$colname2_RecNumAudito = "-1";
if (isset($_POST['codigo'])) {
$colname2_RecNumAudito = (get_magic_quotes_gpc()) ? $_POST['codigo'] : addslashes($_POST['codigo']);
}
$colname4_RecNumAudito = "-1";
if (isset($_POST['software'])) {
$colname4_RecNumAudito = (get_magic_quotes_gpc()) ? $_POST['software'] : addslashes($_POST['software']);
}
$colname3_RecNumAudito = "-1";
if (isset($_POST['empresa'])) {
$colname3_RecNumAudito = (get_magic_quotes_gpc()) ? $_POST['empresa'] : addslashes($_POST['empresa']);
}
mysql_select_db($database_Audito, $Audito);
$query_RecNumAudito = sprintf("SELECT numero FROM auditoria WHERE empresa = %s AND cod_usuario = %s AND software = %s AND fecha = %s ORDER BY numero ASC", GetSQLValueString($colname3_RecNumAudito, "date"),GetSQLValueString($colname2_RecNumAudi to, "int"),GetSQLValueString($colname4_RecNumAudit o, "text"),GetSQLValueString($colname_RecNumAudit o, "text"));
$RecNumAudito = mysql_query($query_RecNumAudito, $Audito) or die(mysql_error());
$row_RecNumAudito = mysql_fetch_assoc($RecNumAudito);
$totalRows_RecNumAudito = mysql_num_rows($RecNumAudito);

mysql_select_db($database_Audito, $Audito);
$query_RecUsuario = "SELECT * FROM usuarios";
$RecUsuario = mysql_query($query_RecUsuario, $Audito) or die(mysql_error());
$row_RecUsuario = mysql_fetch_assoc($RecUsuario);
$totalRows_RecUsuario = mysql_num_rows($RecUsuario);
?>
__________________
Buscando el camino...
  #6 (permalink)  
Antiguo 22/11/2007, 08:17
 
Fecha de Ingreso: junio-2002
Mensajes: 261
Antigüedad: 21 años, 10 meses
Puntos: 0
Re: Realizar submit sin enviar

Segunda parte ya q es muy extenso y no lo soportaba el editor:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SisAudite - Módulo de Opciones</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body >

<div id="Layer1">
<div class="Estilo2" id="IdMenu"><a href="pregauditoria.php">Nueva Auditoria</a> | <a href="auditoriasquery.php">Ver Auditorias</a> | <a href="preguntascreacion.php">Crear Preguntas</a> | <a href="RecUsuarioscreacion.php">Crear Usuarios</a> | <a href="<?php echo $logoutAction ?>">Logout</a> </div>
</div>
<div id="Layer4">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="2%" rowspan="2">&nbsp;</td>
<td colspan="4"><div align="center" class="Estilo8">Realice a continuación la búsqueda de la auditoria que desee calificar</div></td>
<td width="2%" rowspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td width="37%"><span class="Estilo8">
<label>Código de usuario </label>
</span></td>
<td width="23%"><select name="codigo" id="codigo" onClick="submit()">
<?php
do {
?>
<option value="<?php echo $row_RecUsuario['codigo']?>"<?php if (!(strcmp($row_RecUsuario['codigo'], $_POST['codigo']))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecUsuario['codigo']?></option>
<?php
} while ($row_RecUsuario = mysql_fetch_assoc($RecUsuario));
$rows = mysql_num_rows($RecUsuario);
if($rows > 0) {
mysql_data_seek($RecUsuario, 0);
$row_RecUsuario = mysql_fetch_assoc($RecUsuario);
}
?>
</select></td>
<td width="21%"><span class="Estilo8">Empresa</span></td>
<td width="15%"><select name="empresa" id="empresa" onclick="submit()">
<?php
do {
?>
<option value="<?php echo $row_RecEmpresa['empresa']?>"<?php if (!(strcmp($row_RecEmpresa['empresa'], $_POST['empresa']))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecEmpresa['empresa']?></option>
<?php
} while ($row_RecEmpresa = mysql_fetch_assoc($RecEmpresa));
$rows = mysql_num_rows($RecEmpresa);
if($rows > 0) {
mysql_data_seek($RecEmpresa, 0);
$row_RecEmpresa = mysql_fetch_assoc($RecEmpresa);
}
?>
</select></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><span class="Estilo8">Software</span></td>
<td><select name="software" id="software" onclick="submit()">
<?php
do {
?>
<option value="<?php echo $row_RecSoftware['software']?>"<?php if (!(strcmp($row_RecSoftware['software'], $_POST['software']))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecSoftware['software']?></option>
<?php
} while ($row_RecSoftware = mysql_fetch_assoc($RecSoftware));
$rows = mysql_num_rows($RecSoftware);
if($rows > 0) {
mysql_data_seek($RecSoftware, 0);
$row_RecSoftware = mysql_fetch_assoc($RecSoftware);
}
?>
</select></td>
<td><span class="Estilo8">Fecha</span></td>
<td><select name="fecha" id="fecha" onclick="submit()">
<?php
do {
?>
<option value="<?php echo $row_RecFechas['fecha']?>"<?php if (!(strcmp($row_RecFechas['fecha'], $_POST['fecha']))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecFechas['fecha']?></option>
<?php
} while ($row_RecFechas = mysql_fetch_assoc($RecFechas));
$rows = mysql_num_rows($RecFechas);
if($rows > 0) {
mysql_data_seek($RecFechas, 0);
$row_RecFechas = mysql_fetch_assoc($RecFechas);
}
?>
</select></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><span class="Estilo8">Número auditoria </span></td>
<td><select name="numero" id="numero" onChange="submit()">
<?php
do {
?>
<option value="<?php echo $row_RecNumAudito['numero']?>"<?php if (!(strcmp($row_RecNumAudito['numero'], $_POST['numero']))) {echo "selected=\"selected\"";} ?>><?php echo $row_RecNumAudito['numero']?></option>
<?php
} while ($row_RecNumAudito = mysql_fetch_assoc($RecNumAudito));
$rows = mysql_num_rows($RecNumAudito);
if($rows > 0) {
mysql_data_seek($RecNumAudito, 0);
$row_RecNumAudito = mysql_fetch_assoc($RecNumAudito);
}
?>
</select></td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="4"><label> </label></td>
<td>&nbsp;</td>
</tr>
</table>
</form></td>
</tr>
</table>
<p>&nbsp;</p>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form name="form2" method="post" action="calificarauditorias.php">
<label>
<div align="right">
<input name="varnumero" type="hidden" id="varnumero" value="<?php echo $_POST['numero']; ?>">
<input type="submit" name="Submit" value="Enviar">
</div>
</label>
</form>
</td>
</tr>
</table>
<p>&nbsp;</p>
</div>
<table width="719" height="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="127" style="width:719px; height:127px; background-image:url(imagenes/Fondo_03.jpg); background-repeat:no-repeat"><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</tr>
<tr>
<td height="80" style="width:719px; height:178px; background-image:url(imagenes/Fondo_06.jpg); background-repeat:repeat-y"></tr>
<tr>
<td height="60" style="width:719px; height:75px; background-image:url(imagenes/Fondo_06.jpg); background-repeat:repeat-y"></td>
</tr>
<tr>
<td height="150" style="width:719px; height:178px; background-image:url(imagenes/Fondo_06.jpg); background-repeat:repeat-y"></tr>
<tr>
<td style="width:719px; height:30px; background-image:url(imagenes/Fondo_10.jpg); background-repeat:no-repeat">&nbsp;</td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($RecEmpresa);

mysql_free_result($RecSoftware);

mysql_free_result($RecFechas);

mysql_free_result($RecNumAudito);

mysql_free_result($RecUsuario);
?>
__________________
Buscando el camino...
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:07.