<?php
/*******************************************************************************
* filename : tlgvar.php
* last change : 2006 - 11 - 20
*
* http://www.avesan.it/
* Copyright 2006 Alberto Santoro
*
* PMbyAS is free software; you can redistribute it and/or modify
* it under the terms of the GNU General public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
******************************************************************************/
$pgm="tlvar.php";
// --------------- connessione
require_once "./_fcom/fconn.php";
// --------------- sessione
require_once "./_fcom/fsess.php";
// --------------- dati di sessione
require_once "./_fcom/fperiodo.php";
// inclusione della testata HTML
require_once "./_fcom/doctype.php";
// ------------- inclusione barra navigazione
require_once "./_fcom/nav.php";
// --------------- eventuale segnalazione di errore in rientro
// --------------- recupero dei dati digitati il ciclo precedente
if (isset($_REQUEST['merr']))
{$merr = "Errore: " . "{$_REQUEST['merr']}";
$hold = $_REQUEST['hold'];
$post = explode(";", $hold);
$tldx = $post[2];
$tlcd = $post[1];
$com = $post[0];
}
else {$merr = " ";
// --------------- ripresa dei dati di entrata
$tlcd = $_REQUEST["tlcd"];
$com = $_REQUEST["com"];
if ($com == "V")
{$query = "SELECT * FROM tb_lav WHERE LvCod = \"$tlcd\" ";
$stok = mysqli_query($connessione,$query) or die("Query tlv fallita");
$rg = mysqli_fetch_assoc($stok);
$tlcd = $rg["LvCod"]; $tldx = $rg["LvDex"];}
}
// --------------- Intestazione della funzione
$tsfun="Tabella Tipo Attività ";
if ($com == "N") $tsdt1 = "Inserimento"; else $tsdt1 = "Aggiornamento";
require_once "./_fcom/tstnopm.php";
// -------------------- riga eventuale errore
print "<div class=\"cpst\">";
if (isset($_REQUEST['hold'])) print "<div class=\"diverb\">$merr </div>";
print "</div>";
print "<form action=\"tlgagg.php\" method=\"post\">";
// -------------------------- Testata tabella
print "<br /><table width=\"320\" class=\"tbnb\"><tr>";
print "\n<td> </td>";
print "\n<th class=\"t8s\" width=\"40\"> codice</th>";
print "\n<th class=\"t8s\" width=\"150\"> descrizione</th>";
print "\n<th class=\"t8s\" width=\"60\"> </th>";
print "\n<th class=\"t8s\" width=\"60\"> </th>";
print "\n</tr>";
if ($com == "V")
{
$query = "SELECT * FROM tb_lav WHERE LvCod = \"$tlcd\" ";
$stok = mysqli_query($connessione,$query) or die("Query tlv fallita");
$rg = mysqli_fetch_assoc($stok);
print "\n<tr >";
print "\n<td> </td>";
print "\n<td class=\"c8sg\">{$rg["LvCod"]}</td>";
print "\n<td class=\"c8sg\">{$rg["LvDex"]}</td>";
print "\n</tr>";
}
print "\n<tr>";
print "\n<td><input type=\"hidden\" name=\"com\" value=\"$com\"> </td>";
if ($com == "V") print "\n<td><input type=\"hidden\" name=\"tlcd\" value=\"$tlcd\"> </td>";
else print "\n<td><input class=\"text\" type=\"text\" name=\"tlcd\" size=\"3\" maxlength=\"1\"
value =\"$tlcd\" ></td>";
print "\n<td><input class=\"text\" type=\"text\" name=\"tldx\" size=\"24\" maxlength=\"20\"
value =\"$tldx\"></td>";
print "\n<td> </td>";
if ($com == "V")
{print "<td><input class=\"sub\" type=\"submit\" name=\"sub\" value=\"aggiorna\" </td>";
print "\n</tr><tr><td class=\"tdsp\" colspan=\"5\"> </td></tr>";
print "\n<td colspan=\"4\"> </td>";
print "<td><input class=\"sub\" type=\"submit\" name=\"sub\" value=\"elimina\" </td>";}
else
{print "<td><input class=\"sub\" type=\"submit\" name=\"sub\" value=\"registra\" </td>";}
print "\n</tr></table></form><br />";
print "\n<div class=\"cpd\">";
print "\n<ul><li>Codice: 1 caratteri alfanumerici (automaticamente convertiti in maiuscolo)</li>";
print "\n<li>Descrizione: 15 caratteri alfanumerici</li></ul></div>";
?>
</div>
</body>
</html>