1
I have two selects, being the second select totally dependent on the first. I would like to perform the filter, but I’m not able to visualize a solution. Could someone help me?
<!-- Todas as tecnologias -->
<div class="mws-form-block">
<div class="mws-form-row">
<div class="mws-form-item large">
<select name="rTecn" onChange="document.formFilter.submit();">
<option value="">[ Todas as tecnologias ]</option>
<?php
$TECN = getTecnologias();
while ($TECNOLOGIA = mysql_fetch_array($TECN)) {
?>
<option value="<?php echo $TECNOLOGIA["TECNOLOGIA"]; ?>" <?php echo ($TECNOLOGIA["TECNOLOGIA"] == $rTecn) ? 'selected' : '' ?>><?php echo $TECNOLOGIA["TECNOLOGIA"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
<!-- Todos os fornecedores -->
<div class="mws-form-block">
<div class="mws-form-row">
<div class="mws-form-item large">
<select name="rForn" onChange="document.formFilter.submit();">
<option value="">[ Todos os fornecedores ]</option>
<?php
$conexao->setSQL("SELECT * FROM tab_aro_pcd_riscos, tab_aro_pcd_fornecedores WHERE aro_riscos_mfir = aro_forn_mfir GROUP BY aro_forn_mfir ORDER BY aro_forn_nome ASC");
$resultado = $conexao->Consultar();
while ($forn = mysql_fetch_array($resultado)) {
?>
<option value="<?php echo $forn["aro_forn_mfir"]; ?>" <?php echo ($forn["aro_forn_mfir"] == $rForn) ? 'selected' : '' ?>><?php echo $forn["aro_forn_mfir"] . " - " . $forn["aro_forn_nome"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>
What is the error that is happening? I don’t understand. Note: This code is about 10 years old? Register Globals has become OBSOLETE since PHP 5.3.0. Relying on this feature is highly not recommended.
– LeonanCarvalho
I confess to you that the code is very old. I’m actually maintaining it and an update activity has already been required
– Alexsander Caproni
Regarding the error, I would actually like the information of the second select to be reflected based on the choice of the first filter
– Alexsander Caproni
In the second select you must add the value of
$rTecn
sql Where to bring only suppliers related to the selected technology. There is this relationship between technology and vendor in your database?– LeonanCarvalho