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
|
// fichier contact.php
include('template.php');
$template = new Template('template');
$tpl = 'contact';
$template->set_filenames(array($tpl => ''.$tpl.'.tpl'));
$send = false;
if(isset($_POST['submit']) && ($_POST['submit'] == 'Enregistrer') ){
if($_POST['email'] == ""){
$returnEmail = "L'adresse email obligatoire";
$send = "";
}else{
$send = "page";
}
}
$template->assign_vars(array(
'TITLE' => 'Page : '.$tpl.'',
'SEND' => $send,
'ERROR' => $returnEmail
));
$template->pparse($tpl);
// fichier contact.tpl
<html>
</html>
<head>
<link href="styles/styles.css" rel="stylesheet" type="text/css" media="screen"/>
</head>
<body>
<h1>{TITLE}</h1>
<p>
{ERROR}
<form name="" method="post" action="{SEND}">
Adresse email<input type="text" name="email" value="">
<input type="submit" name="submit" value="Enregistrer"></form>
</p>
</body>
</html> |
Partager