salut jutilise zend framework, et je narrive pas a comprendre le script. il marche bien mais pas comme je le veuille. il doit afficher un message derreur en cas de mauvaise entree dans les champs ( nom , prenom , domicile, et autres ) , il naffiche rien quand j'entre des entiers dans ces champs..voici le script:
try {
$userManager = new DBEmploye();
}
catch(Exception $e) {
die('Erreur : '.$e->getMessage());
}
// Code après
$userManager = new DBEmploye();
// var_dump($userManager);
$rste=$userManager->Liste();
if (getvar("btn_enregistrer"))
{
// MEValidForm::AjoutChamp('name_champ','type_contenu',10,150,true);
MEValidForm::AjoutChamp('NOM','text',10,150,true);
MEValidForm::AjoutChamp('PRENOM','text',10,150,true);
MEValidForm::AjoutChamp('DOMICILE','text',10,150,true);
MEValidForm::AjoutChamp('CONTACT','tel',8,20,true);
$ME= count(MEValidForm::$MESSAGE_ERREUR);
if (count(MEValidForm::$MESSAGE_ERREUR)==0)
{
$nom= getvar("NOM");
$prenom= getvar("PRENOM");
$login= getvar("DOMICILE");
$domicile= getvar("CONTACT");
// var_dump($nom,$prenom,$login,$mpd);
$donnees=array();
$donnees["id_employe"]=getvar("");
$donnees["nom_employe"]=getvar("NOM");
$donnees["prenom_employe"]=getvar("PRENOM");
$donnees["dom_employe"]=getvar("DOMICILE");
$donnees["contact_employe"]=getvar("CONTACT");
$donnees["date_insert_employe"]=strftime("%Y/%m/%d %H:%M:%S");
$donnees["date_modification_employe"]=strftime("%Y/%m/%d %H:%M:%S");
$donnees["etat"]=0;
// var_dump($donnees);
//exit();
$ajouter=$userManager->Ajouter($donnees);
}
else
{
throw new Exception("ecrivez ce qui doit etre ecrire! merçi", 1);
}
// var_dump($ajouter);
// exit();
if (!is_null($ajouter))
{
echo "<script type='text/javascript'>document.location.replace('index.php?mod=listeEmploye&page=1');</script>";
}
}
?>
code Html:
<!DOCTYPE html>
<html>
<head>
<title>Ajouts EMPLOYES</title>
<link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<style type="text/css">
.navbar .navbar-fixed-top .navbar-inverse .navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active > a:hover, .navbar-default .navbar-nav > .active > a:focus
{
color: #F5F1F1;
background-color: #F2A182;
}
input:valid {
background-color: #ddffdd;
}
input:invalid {
background-color: #ffdddd;
}
</style>
</head>
<body>
<?php include 'UI/navbar.php'; ?>
<div class="container-fluid">
<div class="row" style="margin-top:50px">
<h1> Ajouts Employes</h1>
<hr/>
</div>
<div class="jumbotron">
<form action="#" method="post" autocomplete="off">
<div class="form-group row">
<label for="Nom" class="col-sm-2 col-form-label">Nom</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="NOM" placeholder="Nom"required="" accesskey="N">
</div>
</div>
<div class="form-group row">
<label for="Prenom" class="col-sm-2 col-form-label">Prenom</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="PRENOM" placeholder="Prenom"required="" accesskey="P">
</div>
</div>
<div class="form-group row">
<label for="Domicile" class="col-sm-2 col-form-label">Domicile</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="DOMICILE" placeholder="Domicile"required="" accesskey="D">
</div>
</div>
<div class="form-group row">
<label for="Contact" class="col-sm-2 col-form-label">Contact</label>
<div class="col-sm-10">
<input type="tel" class="form-control" name="CONTACT" placeholder="Contact"required="" accesskey="C">
</div>
</div>
<div id="paypal-button-container">
</div>
<script src="https://www.paypalobjects.com/api/checkout.js">
</script>
<script>
// Render the PayPal button
paypal.Button.render({
// Set your environment
env: 'sandbox', // sandbox | production
// Specify the style of the button
style: {
layout: 'vertical', // horizontal | vertical
size: 'medium', // medium | large | responsive
shape: 'rect', // pill | rect
color: 'gold' // gold | blue | silver | white | black
},
// Specify allowed and disallowed funding sources
//
// Options:
// - paypal.FUNDING.CARD
// - paypal.FUNDING.CREDIT
// - paypal.FUNDING.ELV
funding: {
allowed: [
paypal.FUNDING.CARD,
paypal.FUNDING.CREDIT
],
disallowed: []
},
// Enable Pay Now checkout flow (optional)
commit: true,
// PayPal Client IDs - replace with your own
// Create a PayPal app: [https://developer.paypal.com/developer/applications/create]
client: {
sandbox: 'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R',
production: '<insert production client id>'
},
payment: function (data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: {
total: '0.01',
currency: 'USD'
}
}
]
}
});
},
onAuthorize: function (data, actions) {
return actions.payment.execute()
.then(function () {
window.alert('Payment Complete!');
});
}
}, '#paypal-button-container');
</script>
<button type="submit" class="btn btn-success" value="btn_enregistrer" name="btn_enregistrer">Ajouter</button>
<a class="btn btn-danger " href="index.php?mod=listeEmploye&page=1">Annuler</a>
</form>
</div>
</div>
<?php include 'UI/footer.php'; ?>
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/jscript.js"></script>
<script>
Afficher la suite