2
I need some help.
I need to make a Search button, get the parameters of some selects(combobox) and update a table below the filters.
But I don’t quite know how to do this, to press every click on the button.
Follow the code I’ve made:
<?php
require_once("conecta.php");
?>
<table>
<tr>
<td>
Marca:<select>
<option>Selecione...</option>
<?php
$query = mysql_query("SELECT * FROM sis_marca");
while($linha = mysql_fetch_array($query)) { ?>
<option value="<?php echo $linha['cod_marca'] ?>"><?php echo $linha['desc_marca'] ?></option>
<?php } ?>
</select>
</td>
<td>
Modelo:<select>
<option>Selecione...</option>
<?php
$query = mysql_query("SELECT * FROM sis_modelo");
while($linha = mysql_fetch_array($query)) { ?>
<option value="<?php echo $linha['seq_modelo'] ?>"><?php echo $linha['desc_modelo'] ?></option>
<?php } ?>
</select>
</td>
<td>
Tipo Modelo:<select>
<option>Selecione...</option>
<?php
$query = mysql_query("SELECT * FROM sis_tipo_modelo");
while($linha = mysql_fetch_array($query)) { ?>
<option value="<?php echo $linha['seq_tipo'] ?>"><?php echo $linha['desc_tipo'] ?></option>
<?php } ?>
</select>
</td>
<td>
<input type="submit" value="Buscar" name="g_marca" />
</td>
</tr>
</table>
<table border="0">
<tr bgcolor="#CCCCCC">
<td width="300"><b>Marca</b></td>
<td width="300"><b>Modelo</b></td>
</tr>
<?php
$query = "SELECT * FROM sis_tipo_modelo_oleo";
$resultado = mysql_query($query);
while ($linha = mysql_fetch_array($resultado)) {
$cod_marca = $linha["cod_marca"];
$cod_modelo= $linha["cod_modelo"];
?>
<tr>
<td><? echo $linha['cod_marca']; ?></td>
<td><? echo $linha['cod_modelo']; ?></td>
</tr>
<?php
}
?>
André if you need that when selecting different results within the selects there is a data toggle within the page below the form according to the selection, you will need jQuery and Ajax to order the database.
– Marcos Vinicius