1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| <?php
// include TPLN (moteur de squelette ou de rendu html)
include('TPLN/TPLN.php');
include('db.inc');
$TPLN = new TPLN;
$TPLN->DbConnect('mysql',$server,$user,$pswd,$database);
if ($_GET['action']=='insert') { // Dans le cas d'une insertion
$TPLN->Open('html/insert.html'); // Formulaire d'insertion
} else if (($_GET['action']=='update')) { // Dans le cas d'une modification
$SQL = "SELECT * FROM $TABLE WHERE $identifiant='".$SQL .=$_GET[$identifiant]."'";
$TPLN->Open('html/maj.html'); // Formulaire de modification
$TPLN->ShowRecords($SQL,0);
} else {
// Dans le cas d'une insertion
if ($_POST && ($_POST['Go']=='Insertion') )
$TPLN->DBInsert($table, $_POST, array('Go'));
// Dans le cas d'une modification
if ($_POST && ($_POST['Go']=='Valider') )
$TPLN->DBUpdate($table, $_POST, "$identifiant=".$_POST[$identifiant], array('Go'));
// Dans le cas d'une suppression
if (isset($_GET['id']))
$TPLN->DBDelete($table, "$identifiant={$_GET[$identifiant]}");
// Ensuite on affiche tout
$TPLN->Open('html/webmaster.html');
$TPLN->SetNavColor('#FFFFFF','#FFFFC0'); // changement de couleurs
$TPLN->ShowRecordsOrderBy(array($identifiant)); // filtre par id et nom
$TPLN->ShowRecords("SELECT * FROM $table", 10); // seulement 10 par page
}
$TPLN->DBClose();
$TPLN->Write();
?>
maj.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Mon projet - édition</title>
</head>
<body>
<IMG
SRC ="../images/banniere.jpg"
width ="760"
height ="190"
alt="banniere paris">
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<script type="text/javascript" src="../js/overlib.js"></script><!-- overLIB (c) Erik Bosrup -->
<div id="menu">
<div class="element_menu">
<h3><b>MENU</b></h3>
<ul>
<li style="color:transparent;"> </li>
<li><a href="../index.php">Accueil</a></li><br>
<li><a href="situation.html">Le logement à Paris aujourd'hui </a></li>
<li style="color:transparent;"> </li>
<li><a href="loyer.html">De quoi le loyer dépend-t-il?</a></li>
<li style="color:transparent;"> </li>
<li><a href="evolution.html">Evolution du logement à Paris</a></li>
<li style="color:transparent;"> </li>
<li><a href="coin.html">Coins sympas à Paris</a></li>
<li style="color:transparent;"> </li>
<li><a href="Contact.html">Nous contacter</a></li>
</ul>
</div>
</div>
<FORM id="form" name="form" action="{$_SERVER['PHP_SELF']}" method="post">
<bloc::data>
<bloc::loop>
Votre nom : <INPUT TYPE=text NAME="nom" value="{Votre nom}"><br><br>
Votre prenom : <input type="text" name="prenom" value="{Votre prenom}" size="30"><br><br>
Votre âge : <input type="text" name="age" value="{Votre âge}" size="50"><br><br>
Dans quel arrondissement souhaitez-vous vivre ?: <input type="text" name="arrondissement" value="{Dans quel arrondissement souhaitez-vous vivre ?}" ><br><br>
Type de logement: <input type="text" name="type" value="{Type de logement}" size="20"><br><br>
Loyer : <input type="text" name="loyer" value="{Loyer}" size="50"><br><br>
<input type="hidden" name="id" value="{id}"><br><br>
<input type="submit" name="Go" value="Valider"> <br><br>
</bloc::loop>
<bloc::norecord>Erreur</bloc::norecord>
</bloc::data>
<A
href="../index.php"
title="Aller sur index">Retour Accueil</A>
<br>
</FORM>
</body>
</html> |
Partager