I have an option
<p> Curso:
<select name='curso' id="aparecercurso" class="escolhercursos">
<option>Nenhum</option>
<?
$sqlcursos = "SELECT designacao FROM cursos";
$respostacurso = mysql_query($sqlcursos,$conexao);
while ($curso = mysql_fetch_array($respostacurso))
{
echo "<option> ".$curso['designacao']."</option>";
}
?>
</select>
</p>
And I wanted to use the value I chose in this option
to open another like this:
<p> Disciplina:
<select name='disciplina' required tabindex="9">
<?
$escolha = $_POST['curso'];
$sqltentar = "SELECT d.designacao_disciplina
FROM disciplinas d, disc_curso dc, cursos c
WHERE c.designacao = '".$escolha."'
AND d.cod_disciplina = dc.cod_disciplina
AND dc.n_curso = c.n_curso ";
$respostacurso = mysql_query($sqltentar,$conexao);
while ($rowcurso = mysql_fetch_array($respostacurso))
{
echo "<option> ".$rowcurso['designacao_disciplina']."</option>";
}
?>
</select>
</p>
I just do not know how to pass the value of the first option
to the next one.
I've already tried as above to go through POST
but I think it would only happen after clicking submit. With javascript I just got the id of the element but then how would I pass it to PHP again?