<?php

foreach (glob("../BL/*.php") as $filename) {
    include $filename;
}
$monto = consultar_monto($_GET["id_curso"]);
if (isset($_POST["tipo_pago"])) {
    realizar_pago($_POST["tipo_pago"], $monto);
    $message = "Pago realizado con Exito!";
    echo "<script type='text/javascript'>alert('{$message}');</script>";
    echo "<meta http-equiv='Refresh' content='0.3;url=index.php'>";
}
?>

<!DOCTYPE HTML>
<html>
	<head>
		<title>SRCL</title>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
		<link rel="stylesheet" href="assets/css/principal.css" />
		<script type="text/javascript" src="assets/js/funciones.js"></script>
		<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
		<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
	</head>
	<body>

		<!-- Five -->
			<section id="" class="main style1">
				<div class="container" id="uno">
// echo "<tr><th><h4>Cedula de Identidad</th><td><input type='text' name=cedula value='$cedula'></td></tr>";
// echo "<tr><th><h4>Correo</th><td><input type='email' name=email value='$email'></td></tr>";
echo "<tr><th><h4>Cursos</th><td>";
if (isset($edad)) {
    $cursos = lista_cursos($edad);
    echo "<select name=cursos>";
    foreach ($cursos as $curso) {
        print_r($curso);
        echo "<option value='" . $curso["ID_CURSO"] . "'>" . $curso["NOMBRE_CURSO"] . "</option>";
    }
    echo "</select></td></tr>";
}
if (isset($_GET["matricula"]) && isset($_POST["cursos"])) {
    $valor = validar_cedula($_POST["cedula"]);
    if ($valor["estado"] == 1) {
        $monto = consultar_monto($_POST["cursos"]);
    }
} else {
    $monto = "";
}
echo "<tr><th><h4>Monto a cancelar: </th><td><input type='text' name=monto value='{$monto}'></td></tr>";
echo "<tr><th><h4>Tipo de pago</th><td>";
$tipo_pago = lista_tipo_pago();
echo "<select name=tipo_pago>";
foreach ($tipo_pago as $tipo) {
    echo "<option value='" . $tipo["ID_TIPO_PAGO"] . "'>" . $tipo["NOMBRE_PAGO"] . "</option>";
}
echo "</select></td></tr>";
echo "</table><br><br>";
echo "<input type='submit' value='Guardar'>";
echo "</form>";