<?php require_once('Connections/cn.php'); ?>
<?php
//header("Content-Type:text/html; charset=UTF-8");
header("Content-Type:text/html; charset=utf-8");
$Area= $_REQUEST["id"];
// Realizo la consulta de la Tabla materias filtrando con la carrera que se seleccion�.

mysql_select_db($database_cn, $cn);
mysql_query ("SET NAMES 'utf8'");
$query_materias = "SELECT id_materia,nombre_materia FROM materias_intro WHERE id_carrera='$Area' ORDER BY semestre,orden";
$rst_materias = mysql_query($query_materias, $cn) or die(mysql_error());
//$row_materias = mysql_fetch_assoc($rst_materias);
$totalRows_materias = mysql_num_rows($rst_materias);  

if($totalRows_materias >0)
{
	$array_select2 = array(0=>"Seleccione...");
	$array_materias = array(0=>"0");
	$code=1;
	while($materia = mysql_fetch_assoc($rst_materias))
		{
		
			$array_materias[$code] = $materia["id_materia"];		
			$array_select2[$code]=  $materia["nombre_materia"];	
			$code += 1;
		}
}		

// Bucle para cargar las maetrias en el combo (materias)
for ($i=0; $i<count($array_select2);$i++){
	echo "<option value=".$array_materias[$i].">".$array_materias[$i].'-'.$array_select2[$i]."</option>";
}

?>