<?php 
include_once 'includes/funcions.php';
include_once 'classes/Form/Formulari.php';
include_once 'classes/Form/Camp.php';
include_once 'classes/Lloguer.php';
if (!comprova_auth()) {
    header("Location: practica_php.php");
    exit;
}
if (!isset($_GET['matricula']) or isset($_GET['matricula']) and empty($_GET['matricula'])) {
    header("Location: llista_lloguer.php");
    exit;
}
$matricula = $_GET['matricula'];
$lloguer = new Lloguer();
$llog = $lloguer->getLloguerEnCursPerVehicle($matricula);
$errors = array();
$form = new Formulari();
$dataf = $form->crearElement("dataf");
$dataf->setTipus("data");
$dataf->setRestriccio(true);
$kmf = $form->crearElement("kmf");
$kmf->setTipus("numeric");
$kmf->setRestriccio(true);
$retorn = $form->crearElement("retorn");
$retorn->setTipus("seleccio", array('A', 'B', 'C', 'D'));
$retorn->setRestriccio(true);
$codi = $form->crearElement("codi");
$codi->setTipus("numeric");
$codi->setRestriccio(true);
if (count($_POST)) {