I am implementing some code but for some reason when I choose an option it retrieves correctly the row I want but I can't select the "Select" to show all the results again.
For example, I have "SELECT", "A", "B". When I choose A or B it shows me the A or B results but when I want it to show all clicking "SELECT" it shows me the last result.
EDIT: And when I choose an option, the option stays "SELECT" and not the one I selected...
The code is:
<td class="titletable2" >GRUPO<font color="#F25C09">: </font></td>
<td>
<select name="grupo_id_grupo" id="id_grupo" onchange="document.getElementById('pesquisaform').submit()">
<option value="-1"
<?php if ($_SESSION["filtro"]['id_'] == '-1' || !isset($_SESSION["filtro"]['grupo_id_grupo'])) { echo "selected"; } ?>>
<?php echo "<option value = '".$grupo['nome']."'";?></option>
<?php
$DB = new DataBase();
$listagrupos = $DB->select_associative_data("grupo", "*");
$DB->disconnect();
foreach ($listagrupos as $grupo){
echo "<option value = '".$grupo['id_grupo']."'";
if( isset($_SESSION["filtro"]['id_grupo']) && $_SESSION["filtro"]['id_grupo'] == $grupo['id_grupo']){ echo "selected";};
echo ">".$grupo['nome']."</option>";
}
?>
</select>
</td>