par
EricJ51 » 30 nov. 2014, 19:14
Voici le code dans son entièreté. Merci pour ton aide.
<?php
session_start();
$GLOBALS['DEBUG_MODE'] = 0;
// CHANGE TO 0 TO TURN OFF DEBUG MODE - IN DEBUG MODE, ONLY THE CAPTCHA CODE IS VALIDATED, AND NO EMAIL IS SENT
error_reporting(E_ALL); ini_set('display_errors', 1);
?>
<!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="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ctr membres</title>
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta name="author" content="EJ51" />
<meta name="description" content="Controle" />
<meta name="keywords" content="controle" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
jQuery(function($){
$.datepicker.regional['fr-CH'] = {
closeText: 'Fermer',
prevText: '<Préc',
nextText: 'Suiv>',
currentText: 'Courant',
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
'Jul','Aoû','Sep','Oct','Nov','Déc'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
weekHeader: 'Sm',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
});
$(document).ready(function() {
$.datepicker.setDefaults( $.datepicker.regional[ "fr-CH" ] );
$( "#datepicker" ).datepicker({
showOn: "button",
buttonImage: "images/cal2.gif",
buttonImageOnly: true
});
});
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="455" colspan="8" align="left" valign="top" class="basictext" border="0"><br />
<?php
process_si_contact_form(); // Process the form, if it was submitted
if (isset($_SESSION['ctform']['error']) && $_SESSION['ctform']['error'] == true): /* The last form submission had 1 or more errors */ ?>
<i><font color="FF0000"><br /><br />Erreur !!! Corriger les champs avec ? rouge !<br /><br /></font></i>
<?php elseif (isset($_SESSION['ctform']['success']) && $_SESSION['ctform']['success'] == true): /* form was processed successfully */ ?>
<i><font color="0000C4"><br /><br />Correct !!! Ajout des infos dans fichier membres.csv.<br /><br /></font></i>
<?php endif; ?>
<form method="post" action="<?php echo $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] ?>" id="contact_form">
<input type="hidden" name="do" value="contact" enctype="text/plain" />
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185"><label> Nom membre </label></td>
<td colspan="4"><select name="ct_name" maxlength="18" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_name']) ?>" />
<?php $name = $_REQUEST['ct_name']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $name == 1 ? $attr : ''; ?> >Adriana</option>
<option value="2" <?php echo $name == 2 ? $attr : ''; ?> >Afonso</option>
<option value="3" <?php echo $name == 3 ? $attr : ''; ?> >Aidan</option>
<option value="4" <?php echo $name == 4 ? $attr : ''; ?> >Ajlan</option>
<option value="5" <?php echo $name == 5 ? $attr : ''; ?> >Alex</option>
</select></td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="20" height="5" align="left" valign="middle"> </td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185"><label> Date entrée </label></td>
<td width="125"><input type="Text" id="datepicker" name="ct_date" maxlength="12" size="12" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_date']) ?>" /></td>
<td width="125" align="right">
<label> Code membre </label></td>
<td width="125"><select name="ct_code" maxlength="5" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_code']) ?>"/>
<?php $code = $_REQUEST['ct_code']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $code == 1 ? $attr : ''; ?> >Code1</option>
<option value="2" <?php echo $code == 2 ? $attr : ''; ?> >Code2</option>
<option value="3" <?php echo $code == 3 ? $attr : ''; ?> >Code3</option>
<option value="4" <?php echo $code == 4 ? $attr : ''; ?> >Code4</option>
<option value="5" <?php echo $code == 5 ? $attr : ''; ?> >Code5</option>
</select></td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="20" height="5" align="left" valign="middle"> </td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185"><label> Frais </label></td>
<td><select name="ct_frais" maxlength="18" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_frais']) ?>" />
<?php $frais = $_REQUEST['ct_frais']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $frais == 1 ? $attr : ''; ?> >Non</option>
<option value="2" <?php echo $frais == 2 ? $attr : ''; ?> >Oui</option>
</select></td>
<td width="185" align="right"><label> Nombre présences </label></td>
<td><select name="ct_nbr" maxlength="18" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_nbr']) ?>" />
<?php $nbr = $_REQUEST['ct_nbr']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $nbr == 1 ? $attr : ''; ?> >1</option>
<option value="2" <?php echo $nbr == 2 ? $attr : ''; ?> >2</option>
<option value="3" <?php echo $nbr == 3 ? $attr : ''; ?> >3</option>
<option value="4" <?php echo $nbr == 4 ? $attr : ''; ?> >4</option>
<option value="5" <?php echo $nbr == 5 ? $attr : ''; ?> >5</option>
</select></td>
<td> </td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="20" height="5" align="left" valign="middle"> </td>
</tr>
</table>
<br />
<img id="captcha" src="/securimage/securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" /> <input type="text" name="ct_captcha" size="10" maxlength="6" /> Copie le code <a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?sid=' + Math.random(); return false"> ou autre code ici </a><?php echo @$_SESSION['ctform']['captcha_error'] ?><br /><br />
<input type="submit" value="Envoyer" /></form><br /><br />
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
// The form processor PHP code
function process_si_contact_form()
{
$_SESSION['ctform'] = array(); // re-initialize the form session data
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
// if the form has been submitted
foreach($_POST as $key => $value) {
if (!is_array($key)) {
// sanitize the input data
if ($key != 'ct_message') $value = strip_tags($value);
$_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
}
}
$name = @$_POST['ct_name']; // name from the form
$date = @$_POST['ct_date']; // date from the form
$code = @$_POST['ct_code']; // code from the form
$frais = @$_POST['ct_frais']; // frais from the form
$nbr = @$_POST['ct_nbr']; // nbr from the form
$captcha = @$_POST['ct_captcha']; // captcha code
$errors = array(); // initialize empty error array
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
// only check for errors if the form is not in debug mode
}
?>
<?php
// Only try to validate the captcha if the form has no errors
// This is especially important for ajax calls
if (sizeof($errors) == 0) {
require_once dirname(__FILE__) . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($captcha) == false) {
$errors['captcha_error'] = 'Verkeerde code !';
}
}
$namelist = array(
"Adriana" => 1,
"Afonso" => 2,
"Aidan" => 3,
"Ajlan" => 4,
"Alex" => 5);
$namemail = array_search($name, $namelist);
$codelist = array(
"Code1" => 1,
"Code2" => 2,
"Code3" => 3,
"Code4" => 4,
"Code5" => 5);
$codemail = array_search($code, $codelist);
$fraislist = array("Non" => 1, "Oui" => 2);
$fraismail = array_search($frais, $fraislist);
$nbrlist = array("1" => 1, "2" => 2, "3" => 3, "4" => 4, "5" => 5);
$nbrmail = array_search($nbr, $nbrlist);
if (sizeof($errors) == 0) {
$outputstring = $namemail.";".$date.";".$codemail.";".$fraismail.";".$nbrmail."\n";
$controle = "membres.csv";
$fp = fopen($controle, "a+");
if (flock($fp, LOCK_EX)) {
fwrite($fp, $outputstring);
flock($fp, LOCK_UN);
} else {
echo "Erreur !!!";
exit;
}
} else {
echo "";
}
echo $namemail." - ".$date." - ".$codemail." - Frais: ".$fraismail." - Nombre: ".$nbrmail." - Security: ".$captcha ;
if (sizeof($errors) == 0) {
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
}
$_SESSION['ctform']['error'] = false; // no error with form
$_SESSION['ctform']['success'] = true; // message sent
} else {
// save the entries, this is to re-populate the form
$_SESSION['ctform']['ct_name'] = $name; // save name from the form submission
$_SESSION['ctform']['ct_date'] = $date; // save date
$_SESSION['ctform']['ct_code'] = $code; // save code
$_SESSION['ctform']['ct_frais'] = $frais; // save frais
$_SESSION['ctform']['ct_nbr'] = $nbr; // save nbr
foreach($errors as $key => $error) {
// set up error messages to display with each field
$_SESSION['ctform'][$key] = "<span style=\"font-weight: bold; color: #f00\">$error</span>";
}
$_SESSION['ctform']['error'] = true; // set error flag
}
} // POST
}
$_SESSION['ctform']['success'] = false; // clear success value after running
?>
Voici le code dans son entièreté. Merci pour ton aide.
[php]
<?php
session_start();
$GLOBALS['DEBUG_MODE'] = 0;
// CHANGE TO 0 TO TURN OFF DEBUG MODE - IN DEBUG MODE, ONLY THE CAPTCHA CODE IS VALIDATED, AND NO EMAIL IS SENT
error_reporting(E_ALL); ini_set('display_errors', 1);
?>
<!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="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ctr membres</title>
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
<meta name="author" content="EJ51" />
<meta name="description" content="Controle" />
<meta name="keywords" content="controle" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
jQuery(function($){
$.datepicker.regional['fr-CH'] = {
closeText: 'Fermer',
prevText: '<Préc',
nextText: 'Suiv>',
currentText: 'Courant',
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
'Jul','Aoû','Sep','Oct','Nov','Déc'],
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
weekHeader: 'Sm',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
});
$(document).ready(function() {
$.datepicker.setDefaults( $.datepicker.regional[ "fr-CH" ] );
$( "#datepicker" ).datepicker({
showOn: "button",
buttonImage: "images/cal2.gif",
buttonImageOnly: true
});
});
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="455" colspan="8" align="left" valign="top" class="basictext" border="0"><br />
<?php
process_si_contact_form(); // Process the form, if it was submitted
if (isset($_SESSION['ctform']['error']) && $_SESSION['ctform']['error'] == true): /* The last form submission had 1 or more errors */ ?>
<i><font color="FF0000"><br /><br />Erreur !!! Corriger les champs avec ? rouge !<br /><br /></font></i>
<?php elseif (isset($_SESSION['ctform']['success']) && $_SESSION['ctform']['success'] == true): /* form was processed successfully */ ?>
<i><font color="0000C4"><br /><br />Correct !!! Ajout des infos dans fichier membres.csv.<br /><br /></font></i>
<?php endif; ?>
<form method="post" action="<?php echo $_SERVER['REQUEST_URI'] . $_SERVER['QUERY_STRING'] ?>" id="contact_form">
<input type="hidden" name="do" value="contact" enctype="text/plain" />
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185"><label> Nom membre </label></td>
<td colspan="4"><select name="ct_name" maxlength="18" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_name']) ?>" />
<?php $name = $_REQUEST['ct_name']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $name == 1 ? $attr : ''; ?> >Adriana</option>
<option value="2" <?php echo $name == 2 ? $attr : ''; ?> >Afonso</option>
<option value="3" <?php echo $name == 3 ? $attr : ''; ?> >Aidan</option>
<option value="4" <?php echo $name == 4 ? $attr : ''; ?> >Ajlan</option>
<option value="5" <?php echo $name == 5 ? $attr : ''; ?> >Alex</option>
</select></td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="20" height="5" align="left" valign="middle"> </td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185"><label> Date entrée </label></td>
<td width="125"><input type="Text" id="datepicker" name="ct_date" maxlength="12" size="12" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_date']) ?>" /></td>
<td width="125" align="right">
<label> Code membre </label></td>
<td width="125"><select name="ct_code" maxlength="5" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_code']) ?>"/>
<?php $code = $_REQUEST['ct_code']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $code == 1 ? $attr : ''; ?> >Code1</option>
<option value="2" <?php echo $code == 2 ? $attr : ''; ?> >Code2</option>
<option value="3" <?php echo $code == 3 ? $attr : ''; ?> >Code3</option>
<option value="4" <?php echo $code == 4 ? $attr : ''; ?> >Code4</option>
<option value="5" <?php echo $code == 5 ? $attr : ''; ?> >Code5</option>
</select></td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="20" height="5" align="left" valign="middle"> </td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185"><label> Frais </label></td>
<td><select name="ct_frais" maxlength="18" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_frais']) ?>" />
<?php $frais = $_REQUEST['ct_frais']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $frais == 1 ? $attr : ''; ?> >Non</option>
<option value="2" <?php echo $frais == 2 ? $attr : ''; ?> >Oui</option>
</select></td>
<td width="185" align="right"><label> Nombre présences </label></td>
<td><select name="ct_nbr" maxlength="18" readonly="readonly" value="<?php echo htmlspecialchars(@$_SESSION['ctform']['ct_nbr']) ?>" />
<?php $nbr = $_REQUEST['ct_nbr']; ?>
<?php $attr = 'selected="selected"'; ?>
<option value="1" <?php echo $nbr == 1 ? $attr : ''; ?> >1</option>
<option value="2" <?php echo $nbr == 2 ? $attr : ''; ?> >2</option>
<option value="3" <?php echo $nbr == 3 ? $attr : ''; ?> >3</option>
<option value="4" <?php echo $nbr == 4 ? $attr : ''; ?> >4</option>
<option value="5" <?php echo $nbr == 5 ? $attr : ''; ?> >5</option>
</select></td>
<td> </td>
</tr>
<tr>
<td width="20" height="5" align="left" valign="middle"> </td>
<td width="185" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="125" height="5" align="left" valign="middle"> </td>
<td width="20" height="5" align="left" valign="middle"> </td>
</tr>
</table>
<br />
<img id="captcha" src="/securimage/securimage_show.php?sid=<?php echo md5(uniqid()) ?>" alt="CAPTCHA Image" /> <input type="text" name="ct_captcha" size="10" maxlength="6" /> Copie le code <a href="#" onclick="document.getElementById('captcha').src = '/securimage/securimage_show.php?sid=' + Math.random(); return false"> ou autre code ici </a><?php echo @$_SESSION['ctform']['captcha_error'] ?><br /><br />
<input type="submit" value="Envoyer" /></form><br /><br />
</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
// The form processor PHP code
function process_si_contact_form()
{
$_SESSION['ctform'] = array(); // re-initialize the form session data
if ($_SERVER['REQUEST_METHOD'] == 'POST' && @$_POST['do'] == 'contact') {
// if the form has been submitted
foreach($_POST as $key => $value) {
if (!is_array($key)) {
// sanitize the input data
if ($key != 'ct_message') $value = strip_tags($value);
$_POST[$key] = htmlspecialchars(stripslashes(trim($value)));
}
}
$name = @$_POST['ct_name']; // name from the form
$date = @$_POST['ct_date']; // date from the form
$code = @$_POST['ct_code']; // code from the form
$frais = @$_POST['ct_frais']; // frais from the form
$nbr = @$_POST['ct_nbr']; // nbr from the form
$captcha = @$_POST['ct_captcha']; // captcha code
$errors = array(); // initialize empty error array
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
// only check for errors if the form is not in debug mode
}
?>
<?php
// Only try to validate the captcha if the form has no errors
// This is especially important for ajax calls
if (sizeof($errors) == 0) {
require_once dirname(__FILE__) . '/securimage/securimage.php';
$securimage = new Securimage();
if ($securimage->check($captcha) == false) {
$errors['captcha_error'] = 'Verkeerde code !';
}
}
$namelist = array(
"Adriana" => 1,
"Afonso" => 2,
"Aidan" => 3,
"Ajlan" => 4,
"Alex" => 5);
$namemail = array_search($name, $namelist);
$codelist = array(
"Code1" => 1,
"Code2" => 2,
"Code3" => 3,
"Code4" => 4,
"Code5" => 5);
$codemail = array_search($code, $codelist);
$fraislist = array("Non" => 1, "Oui" => 2);
$fraismail = array_search($frais, $fraislist);
$nbrlist = array("1" => 1, "2" => 2, "3" => 3, "4" => 4, "5" => 5);
$nbrmail = array_search($nbr, $nbrlist);
if (sizeof($errors) == 0) {
$outputstring = $namemail.";".$date.";".$codemail.";".$fraismail.";".$nbrmail."\n";
$controle = "membres.csv";
$fp = fopen($controle, "a+");
if (flock($fp, LOCK_EX)) {
fwrite($fp, $outputstring);
flock($fp, LOCK_UN);
} else {
echo "Erreur !!!";
exit;
}
} else {
echo "";
}
echo $namemail." - ".$date." - ".$codemail." - Frais: ".$fraismail." - Nombre: ".$nbrmail." - Security: ".$captcha ;
if (sizeof($errors) == 0) {
if (isset($GLOBALS['DEBUG_MODE']) && $GLOBALS['DEBUG_MODE'] == false) {
}
$_SESSION['ctform']['error'] = false; // no error with form
$_SESSION['ctform']['success'] = true; // message sent
} else {
// save the entries, this is to re-populate the form
$_SESSION['ctform']['ct_name'] = $name; // save name from the form submission
$_SESSION['ctform']['ct_date'] = $date; // save date
$_SESSION['ctform']['ct_code'] = $code; // save code
$_SESSION['ctform']['ct_frais'] = $frais; // save frais
$_SESSION['ctform']['ct_nbr'] = $nbr; // save nbr
foreach($errors as $key => $error) {
// set up error messages to display with each field
$_SESSION['ctform'][$key] = "<span style=\"font-weight: bold; color: #f00\">$error</span>";
}
$_SESSION['ctform']['error'] = true; // set error flag
}
} // POST
}
$_SESSION['ctform']['success'] = false; // clear success value after running
?>[/php]