Hola a todos, tengo el siguiente problema, estoy haciendo una consulta sql con parametros externos, funciona pero lo que necesito es llenar estos parametros (string) con los resultados de un combo (select), el codigo es el siguiente
<?php
if ($_GET['flag']=="envio"){
$A1= "GABINETES";
if ($conn_access = odbc_connect ( "help", "", "")){
echo "Conectado correctamente";
} else{
echo "Error en la conexión con la base de datos";
}
$ssql = "SELECT Familias.nomb_fami, Articulos.eliminado, Familias.nomb_fami, Articulos.cod_art, Articulos.nomb_art, Articulos.stock_actual_art, Articulos.ult_precio_costo, Articulos.precio_costo_prom
FROM Familias INNER JOIN Articulos ON Familias.cod_fami = Articulos.cod_fami
WHERE Familias.nomb_fami='$A1' AND Articulos.eliminado=False
ORDER BY Articulos.nomb_art";
if($rs_access = odbc_exec ($conn_access, $ssql)){
echo "La sentencia se ejecutó correctamente";
}else{
echo "Error al ejecutar la sentencia SQL";
}
?>
<table width="939" height="34" border="1" class="Estilo2">
<tr>
<th width="137" height="28" scope="col">CODIGO</th>
<th width="325" scope="col">NOMBRE</th>
<th width="54" scope="col">STOCK</th>
<th width="80" scope="col">ULTIMO $ COSTO </th>
<th width="84" scope="col">PROM $ VENTA </th>
<th width="105" scope="col">MARCA</th>
<th width="108" scope="col">FAMILIA</th>
</tr>
</table>
<? do { ?>
<table width="942" height="11" border="0" class="Estilo2">
<tr>
<td width="140" height="22"><?php echo "". $fila->cod_art; ?></td>
<td width="330"><?php echo "". $fila->nomb_art; ?></td>
<td width="54"><?php echo "". $fila->stock_actual_art; ?></td>
<td width="83"><?php echo "". $fila->ult_precio_costo; ?></td>
<td width="87"><?php echo "". $fila->precio_costo_prom; ?></td>
<td width="104"><?php echo "". $fila->nomb_marc; ?></td>
<td width="114"><?php echo "". $fila->nomb_fami; ?></td>
</tr>
</table>
<?php } while ($fila = odbc_fetch_object($rs_access));
}else{
?>
<html>
<style type="text/css">
<!--
.Estilo2 {
color: #0000FF;
background-color: #FFFF99;
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
font-weight: bold;
text-transform: capitalize;
font-style: normal;
line-height: normal;
}
-->
</style>
<body>
<?
if ($conn_access = odbc_connect ( "help", "", "")){
echo "Conectado correctamente";
} else{
echo "Error en la conexión con la base de datos";
}
$ssql = "select * from Familias";
if($rs2_access = odbc_exec ($conn_access, $ssql)){
echo "La sentencia se ejecutó correctamente";
}else{
echo "Error al ejecutar la sentencia SQL";
}
?>
<form name="formu" method="get">
<select name="select">
<?php
do {
?>
<option value="<?php echo "". $fila->nomb_fami; ?>"><?php echo "". $fila->nomb_fami; ?></option>
<?php } while ($fila = odbc_fetch_object($rs2_access));
$A1= "GABINETES";
?>
</select>
<input type="hidden" name="var1" value="select.value">
<input type="hidden" name="flag" value="envio">
<input type="submit" name="Submit" value="aceptar">
</form>
</body>
</html>
<?php
}
?>
Bueno, como ven funciona al darle un parametro string fijo como variable ($a1=gabinetes) pero necesito entregarle los string que me devuelve el recordset $rs2 al select llamado "select"