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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
| <?php
$titre="Nouveau client";
include_once("entete.php");
?>
<div id="corps">
<?php
//sauvegarde de la date au format Mysql
$date=date('Y-m-d');
echo $date.'<br/>';
$NOM_CLIENT= isset($_POST['NOM_CLIENT']) ? $_POST['NOM_CLIENT'] : '';
$PRENOM_CLIENT= isset($_POST['PRENOM_CLIENT']) ? $_POST['PRENOM_CLIENT'] : '';
$Noposte_CLIENT= isset($_POST['Noposte_CLIENT']) ? $_POST['Noposte_CLIENT'] : '';
$No_uf_CLIENT= isset($_POST['No_uf_CLIENT']) ? $_POST['No_uf_CLIENT'] : '';
$secteur_CLIENT= isset($_POST['secteur_CLIENT']) ? $_POST['secteur_CLIENT'] : '';
$service_CLIENT= isset($_POST['service_CLIENT']) ? $_POST['service_CLIENT'] : '';
$localisation_CLIENT= isset($_POST['localisation_CLIENT']) ? $_POST['localisation_CLIENT'] : '';
if ($NOM_CLIENT and $PRENOM_CLIENT and $Noposte_CLIENT and $No_uf_CLIENT and $secteur_CLIENT and $service_CLIENT and $localisation_CLIENT)
{
//on verifie que le nouveau client n'existe pas deja
$requete_prepare=$connexion->prepare("select ID_CLIENT from client NOM_CLIENT= ?
and PRENOM_CLIENT= ? and Noposte_CLIENT= ? and No_uf_CLIENT= ? and secteur_CLIENT= ? and service_CLIENT= ? and localisation_CLIENT= ?");
$requete_prepare->execute(array($NOM_CLIENT,$PRENOM_CLIENT,$Noposte_CLIENT,$No_uf_CLIENT,$secteur_CLIENT,$service_CLIENT,$localisation_CLIENT));
$retour=$requete_prepare->rowCount();// Retourne le nombre de lignes affectées par le dernier appel à la fonction PDOStatement::execute()
if ( $retour==0)
{
// insertion du nouveau client
$requete_prepare_1=$connexion->prepare("INSERT INTO client VALUES ('' ,?,?,?,?,?,?,?)");
$requete_prepare_1->execute(array($NOM_CLIENT,$PRENOM_CLIENT,$Noposte_CLIENT,$No_uf_CLIENT,$secteur_CLIENT,$service_CLIENT,$localisation_CLIENT));
echo '<br/>Nouveau client ajouté';
}
else
{
echo 'Client existant';
}
}
else
{
?>
<html>
<body bgcolor=blue>
<h2>Nouveau Client</h2>
<form action="creation_client.php" method="post">
<table>
<tr><td>
<span class="etoile">*</span>NOM_CLIENT :
</td><td>
<input type="text" name="NOM_CLIENT" />
</td></tr>
<tr><td>
PRENOM_CLIENT :
</td><td>
<input type="text" name="PRENOM_CLIENT" />
</td></tr>
<tr><td>
<span class="etoile">*</span>Noposte_CLIENT:
</td><td>
<input type="text" name="Noposte_CLIENT" />
</td></tr>
<tr><td>
No_uf_CLIENT:
</td><td>
<input type="text" name="No_uf_CLIENT" />
</td></tr>
<tr><td>
<span class="etoile">*</span>secteur_CLIENT:
</td><td>
<input type="text" name="secteur_CLIENT" />
</td></tr>
<tr><td>
<span class="etoile">*</span>service_CLIENT :
</td><td>
<input type="text" name="service_CLIENT" />
</td></tr>
<tr><td>
<span class="etoile">*</span>localisation_CLIENT :
</td><td>
<input type="text" name="localisation_CLIENT" />
</td></tr>
<tr><td>
</td><td>
<input type="submit" value="OK"/>
</td></tr>
</table>
Les champs suivant<span class="etoile">*</span> sont obligatoires.
</form>
</html>
</body>
<?php
}
?>
</div>
<?php
include_once("pied_de_page.php");
?> |
Partager