Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/12/2012, 06:35
peinprats
 
Fecha de Ingreso: mayo-2012
Mensajes: 25
Antigüedad: 12 años
Puntos: 1
Exclamación Pasar el contenido de un select a una consulta mediante GET ?

Buenas a todos!

Pues básicamente lo que tengo es un formulario con "selects" en el cual las opciones van introducidas por array al los selects. Por tanto cuando se hace clic en el botón "enviar" para realizar la consulta mediante POST, necesitaría recoger el dato seleccionado en el SELECT correspondiente y recogerlo.

el codigo que tengo seria este:

Código:
<form id='historico' action="php/selechistorico.php" method="post" name="formu">
	<table border="0" width="220" cellspacing="0" cellpadding="0">
	<tr>
		<td colspan="2">
		<p align="center"><b><font face="Arial" size="4">SELECCIONE SERVICIO</font></b></td>
	</tr>
	<tr>
		<td width="92">&nbsp;</td>
		<td width="156">&nbsp;</td>
	</tr>
	<tr>
		<td width="92"><font face="Arial">Actividad</font></td>
		<td width="156"><?php include("conexionBaseDatos.php");
					
					
                    $consulta1_mysql='select r.idZona,  r.*, z.* from reservas r INNER JOIN zonas z ON r.idZona = z.idZona WHERE idSocio="'.$_SESSION['idSocio'].'" AND r.Borrado ="0" AND r.insertado="1"' ;
                    $resultado1=mysql_query($consulta1_mysql,$conex);
  
					echo "<select id='activity'>";
					while($fila=mysql_fetch_array($resultado1)){
						
						echo "<option value='".$fila['Nombre']."'>".$fila['Nombre']."</option>";
					
					}
					
?>
</select></td>
	</tr>
	<tr>
		<td width="92">&nbsp;</td>
		<td width="156">&nbsp;</td>
	</tr>
	<tr>
		<td width="92"><font face="Arial">Desde</font></td>
		<td width="156"><input class="keyboardInput" type="text" value="12/20/2012" data-date-format="mm/dd/yy" id="desde" size="12px" ></td>
	</tr>
	<tr>
		<td width="92">&nbsp;</td>
		<td width="156">&nbsp;</td>
	</tr>
	<tr>
		<td width="92"><font face="Arial">Hasta</font></td>
		<td width="156"><input type="text" class="keyboardInput" value="12/20/2012" id="hasta" size="12px" ></td>
	</tr>
	<tr>
		<td width="92">&nbsp;</td>
		<td width="156">&nbsp;</td>
	</tr>
	<tr>
		<td width="92"><font face="Arial">Persona</font></td>
		<td width="156"><?php

	mysql_query("SET NAMES 'utf8'");
	$beneficiarios = mysql_query("SELECT DISTINCT s.usuario, t.Nombre, concat(trim(s.Apellidos),', ',trim(s.Nombre)) as nombre FROM socios s INNER JOIN tipossocios t ON t.idTipoSocio = s.idTipoSocio where idSocioPrincipal = 0 AND s.borrado = 0 AND s.idempresa = '001' AND idSocioBeneficiario = ".$_SESSION['idSocioPrincipal'].""); 
	 	
		if ($_SESSION['idSocioPrincipal']) {
		echo "<select id='beneficiarios'>";
		echo "<option value='TODOS'>TODOS</option>";
		while ($registro = mysql_fetch_array($beneficiarios)) {
		$benef = substr($registro['Nombre'], 6);
		
		echo "<option value='".$registro['Nombre']."'>$benef</option>";
		}
	}
	else { 
			echo "<select id='beneficiarios'>";
			echo "<option value='TODOS'>TODOS</option>";}
		
?>
</select></td>
	</tr>
	<tr>
		<td width="92">&nbsp;</td>
		<td width="156">&nbsp;</td>
	</tr>
	<tr>
		<td width="92">&nbsp;</td>
		<td width="156">
		<p align="center">
		<input type=image src="images/botonfiltrar.png" width="144" height="49"></td>
	</tr>
</table></form>
Y me gustaria recoger los selects para hacer una consulta y mostrar los resultados. Gracias de ante mano