Thank you for your quick answer, it helped me solve one of my problems.
Even so i still need to find a way to do the next:
I have this first table named “gestión_carreras”
id | nombre_carrera |
1 | carrera_1 |
2 | carrera_2 |
Now i have this second table where “nombre_carrera” is a foreing key from the first table (id).
id | nombre_materia | nombre_carrera |
1 | materia_1 | 1 |
2 | materia_2 | 2 |
And this third table “gestión_cursada” is used to insert 2 foreign keys from tables 1 and 2 on this table, using two dropdowns.
id | nombre_carrera | nombre_materia | alumno |
1 | 1 | 1 | alumno1 |
2 | 2 | 3 | alumno1 |
Foreing keys:
Nombre_carrera (use id from table 1)
Nombre_materia(use id from table 2)
I adapted one of the codes from your forums to fill my first dropdown using the first table, and it works.
<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT nombre_carrera, id FROM #__gestion_carreras");
$contents = $db->loadObjectList();
$listdata = "Elegir carrera;0;\n";
for ($i = 0; $i < count($contents); $i++) {
$listdata .= "{$contents[$i]->nombre_carrera};{$contents[$i]->id}\n";
}
$value = $listdata;
?>
Now that i have an id selected in this first dropdown. I would like to know if it is posible to make the second to only show values from the second table that only have that id(nombre_carrera).
Sorry for the mess im pretty new with this.