<?php
	session_start();

	include("auth.inc.php");
	include "conn.inc.php";

	if ($_POST["accion_matricula".$_POST["id_matricula"]] == "e") {
		$q_delete = "DELETE FROM matriculas_detalles WHERE matricula_id='".$_POST["id_matricula"]."'";
		$r_delete = mysql_query($q_delete, $conn);

		$q_delete2 = "DELETE FROM matriculas WHERE id='".$_POST["id_matricula"]."'";
		$r_delete2 = mysql_query($q_delete2, $conn);

	} else {
		$q_update = "UPDATE matriculas SET usuario_id='".$_POST["usuario_id".$_POST["id_matricula"]]."',
					 liquidacion_id='".$_POST["liquidacion_id".$_POST["id_matricula"]]."',
					 pendiente='".$_POST["pendiente".$_POST["id_matricula"]]."',
					 fecha='".date(Y."-".n."-".j)."',
	                 responsable='".$_SESSION["nif"]."'
	                 WHERE id='".$_POST["id_matricula"]."'";
		$r_update = mysql_query($q_update, $conn);
	}

	header("Location: ../inicio.php");
?>