Foros del Web » Programando para Internet » PHP »

problema con form e include

Estas en el tema de problema con form e include en el foro de PHP en Foros del Web. hola pasa lo siqguiente ... tengo una pagina principal llamada "formulario.php" y el codigo es este Código: elseif($op==2){ ?> <h2>Consultas</h2> <br/> <br/> <table width="80%" height="45" ...
  #1 (permalink)  
Antiguo 29/09/2008, 13:29
 
Fecha de Ingreso: febrero-2008
Mensajes: 73
Antigüedad: 16 años, 2 meses
Puntos: 0
problema con form e include

hola pasa lo siqguiente ...
tengo una pagina principal llamada "formulario.php"

y el codigo es este

Código:
elseif($op==2){ ?>
    <h2>Consultas</h2>
    <br/>
    <br/>
	
    <table width="80%" height="45" border="0" cellspacing="1">
      <tr valign="top"><form name="busca" method="post" action="formulario.php?op=2">
        <td width="8%">Buscar</td>
        <td width="25%"><input type="text" name="buscar" size="30" /></td>
        <td width="5%"></td>
        <td width="62%" >
		  <select name="opcion">
		    <option value="0">&nbsp;</option>
			<option value="1">Nro. Contenedor</option>
            <option value="2">Nro. Documento</option>
            <option value="3">Fecha</option>
          </select>
		    <input type="submit" name="Button1" value="Ir" />
    
		</td></form>   
      </tr>	  
    </table>
	<? $query=$_POST['opcion'];
	  	$var=$_POST['buscar'];
				
			include("consultar.php");
		
	?>
que al final del codigo llama a "consultar.php", cuanfo la $query es 3, entra al archivo "consultar.php" y muestra el siqguiente codigo:

Código:
<? }
if($query==3){ 

include "consulta_fecha.php";
}
?>
y en "consulta_fecha.php"

Código:
<br/>

<table width="59%" border="1" cellspacing="0">
  <tr><form method="post" action="consulta_fecha.php">
    <td width="9%"> Inicio </td>
    <td width="36%"><input type="text" id="inicio" name="inicio"/> <button id="buttoninicio" >...</button></td>
    <td width="6%">Fin </td>
    <td width="39%"><input type="text" id="fin" name="fin"/> <button id="buttonfin"  >...</button></td>
	<td width="10%"><input type="submit" name="submit" value="Buscar" /></td>
    </form> </tr>
</table>

	
  <script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "inicio",         // ID of the input field
      ifFormat    : "%Y/%m/%d",    // the date format
      button      : "buttoninicio"       // ID of the button
    }
  );
  </script>
  <script type="text/javascript">
    Calendar.setup(
    {
      inputField  : "fin",         // ID of the input field
      ifFormat    : "%Y/%m/%d",    // the date format
      button      : "buttonfin"       // ID of the button
    }
  );
   </script>
   
   <?
  
    $inicio=$_post['inicio'];
	$fin=$_post['fin'];
	echo $inicio;
	
	?>
el problema es que al momento de entrar a "consulta_fecha" y presionar "Buscar", el form asume que el action es el del "formulario.php" y no el "consulta_fecha.php "

que hago????
  #2 (permalink)  
Antiguo 29/09/2008, 13:52
Avatar de masterojitos  
Fecha de Ingreso: julio-2008
Ubicación: Lima Callao Chucuito
Mensajes: 1.931
Antigüedad: 15 años, 9 meses
Puntos: 105
Respuesta: problema con form e include

solo se puede ver que en buscar se debe de ir a "consulta_fecha.php ":
<form method="post" action="consulta_fecha.php">

asi que nose en verdad cual es problema, se mas explicito. suerte.
__________________
Atte. MasterOjitos :ojotes:
Todo sobre Programación Web
Las ultimas tendencias en Efectos y Recursos Web: MasterOjitos Blog
  #3 (permalink)  
Antiguo 29/09/2008, 13:55
Avatar de eldjmix  
Fecha de Ingreso: enero-2007
Ubicación: Puerto Madryn, Argentina
Mensajes: 73
Antigüedad: 17 años, 3 meses
Puntos: 0
Respuesta: problema con form e include

estas usando include, esto hace que se incluya todo el codigo dentro de formulario.php, cuando la variable $query es 3, entonces , en el ultimo codigo le tenes que poner action="formulario.php?op=2".

si me equivoco corrijanme,
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 16:25.