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 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
| <?php
//session pour stocker des variables sur toutes les pages lors de la connexion
session_start();
if(isset($_SESSION["login"]) && $_SESSION["login"]!="")
{
?>
<html>
<head>
<title> Kheops organisation </title>
<!-- Pour la comptabilité avec les différents navigateurs -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta name="robots" content="noindex">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<?php
include('headerComm.php'); ?>
</head>
<body>
<?php
//$connexion or die("erreur lors de la connexion à phpmyadmin");
$connexion=mysql_connect("localhost", "root", "") or die("erreur lors de la connexion à phpmyadmin");
//Choix de la base de donnée
$bdd=mysql_select_db("bdd_khops", $connexion) or die("erreur lors de la connexion à la bdd");
?>
<!-- formulaire -->
<form method="POST" name="base" action="modifier.php" enctype="multipart/form-data">
<?php
//Requete qui selectionne tous les employé de da BDD par ordre id croissante
$requete = mysql_query("SELECT * FROM client ORDER BY id") or die("erreur requete");
//Affichage de l'id, nom, prenom des employés (venant de la requete) pour affichage
//Pour le choix de l'employé à modifier
?>
<br/>
<H2>Modifier un bon de commande</h2>
<br/>
Client :
<select name='id'>
<?php
//Tant que l'on a une ligne à lire dans le resultat de la requete, on ajoute une ligne à la liste déroulante
//On met l'id dans la value de <option> pour la clause WHERE lors de la modification des infos de l'employé
while($ligne = mysql_fetch_array($requete))
{
$id = $ligne['id'];
$login = $ligne['login'];
?>
<option value="<?php echo $id ; ?>"><?php echo $id." - ".$login; ?></option>
<?php
}
?>
</select>
<input type="submit" name="voir" value="Valider" />
<?php
//Si on appuie sur le bouton "voir" alors requete sql
if(isset($_POST['voir'])){
$id = $_POST['id'];
$requete1 = mysql_query("SELECT * FROM client WHERE id = $id" ) or die("erreur requete retour info");
$ligne1 = mysql_fetch_array($requete1);
?> </form>
<!-- C'est le formulaire qu'on récupére une fois qu'on a choisi le bon de commande -->
<form method="POST" name="base" action="modifier.php" enctype="multipart/form-data">
<h2 style="text-align:left;">BON DE COMMANDE DE <b style="color:red"> <?php echo strtoupper ($ligne1['login']);?></b></h2>
<table style="text-align:left;" border="0">
<tr>
<td>Intitulé du projet</td>
<td><input type="text" size= "25" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="intitule" placeholder="Intitule du projet" maxlength="25" value="<?php echo $ligne1['intitule'];?> " /></td>
</tr>
<tr>
<td>Détails du projet</td>
<td><textarea style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="detail" cols="50" rows="4" placeholder="Expliquez brièvement votre projet" ><?php echo $ligne1['detail'];?></textarea></td>
</tr>
<tr>
<td>Votre contact commercial</td>
<td> <input type="text" size= "25" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="contactCommercial" placeholder="Votre contact commercial" maxlength="25" value="<?php echo $ligne1['contactCommercial'];?> "/></td>
</tr>
<tr>
<td>Date de mise en service souhaitée</td>
<td> <input type="date" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" size="32" name="date" placeholder="Date de mise en service souhaitée" /></td>
</tr>
</table>
<br/>
<h3 align="left"><font color="black">Identification du client</font ></h3>
<br/>
<table border="0">
<tr>
<td>Raison sociale </td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" size= "35" name="rs" placeholder="Raison sociale" maxlength="25" value="<?php echo $ligne1['rs'];?> " /></td>
</tr>
<tr>
<td>N° de SIRET </td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" size= "35" name="siret" placeholder="N° de SIRET" maxlength="25" value="<?php echo $ligne1['siret'];?> " /></td>
</tr>
<tr>
<td>Code APE/NAF </td>
<td> <input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" size= "35" name="codeAPENAF" placeholder="Code APE/NAF" maxlength="25" value="<?php echo $ligne1['codeAPENAF'];?> "/></td>
</tr>
<tr>
<td>N°TVA intracommunautaire </td>
<td> <input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" size= "35" name="TVAIntra" placeholder="Date de mise en service souhaitee" maxlength="25" value="<?php echo $ligne1['TVAIntra'];?> "/></td>
</tr>
<tr>
<td>Adresse :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" size= "50" name="adresse" placeholder="Adresse" maxlength="50" value="<?php echo $ligne1['adresse'];?> "/></td>
</tr>
<tr>
<td>Ville :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" size= "25" name="ville" maxlength="25" placeholder="Ville" value="<?php echo $ligne1['ville'];?> " /></td>
</tr>
<tr>
<td>Code postal :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="cp" placeholder="Code postal" maxlength="5" value="<?php echo $ligne1['cp'];?> " /></td>
</tr>
</table>
</div>
<div>
<h4 align="left"><font color="black">Représentant légal</font color></h4>
<br/>
<table border="0">
<tr>
<div><td>Nom :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="rl_nom" placeholder="Nom" maxlength="25" value="<?php echo $ligne1['rl_nom'];?> "/></td></div>
</tr>
<tr>
<td>Prénom :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="rl_prenom" placeholder="Prenom" maxlength="25" value="<?php echo $ligne1['rl_prenom'];?> "/></td>
</tr>
<tr>
<td>Fonction :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="rl_fonction" placeholder="Fonction" maxlength="25" value="<?php echo $ligne1['rl_fonction'];?> "/></td>
</tr>
<tr>
<td>Téléphone :</td>
<td><input type="tel" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="rl_tel" maxlength="10" placeholder="Numero de telephone" value="<?php echo $ligne1['rl_tel'];?> " /></td>
</tr>
<tr>
<td>Mobile :</td>
<td><input type="tel" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="rl_mobile" maxlength="10" placeholder="Mobile" value="<?php echo $ligne1['rl_mobile'];?> " /></td>
</tr>
<tr>
<td>Adresse e-mail :</td>
<td><input type="email" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="rl_mail" maxlength="50" placeholder="Adresse e-mail" value="<?php echo $ligne1['rl_mail'];?> "/></td>
</tr>
</table>
</div>
<br/>
<div>
<table border="0">
<tr>
<th><b>Contrat facturation / Comptabilité**</b></th>
<th></th><th></th><th><b>Contact technique***</b></th>
<tr>
<td>Nom :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="cf_nom" placeholder="Nom" maxlength="25" value="<?php echo $ligne1['cf_nom'];?> "/></td>
<td>Nom :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="ct_nom" placeholder="Nom" maxlength="25" value="<?php echo $ligne1['ct_nom'];?> "/></td>
</tr>
<tr>
<td>Prénom :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="cf_prenom" placeholder="Prenom" maxlength="25" value="<?php echo $ligne1['cf_prenom'];?> "/></td>
<td>Prénom :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="ct_prenom" placeholder="Prenom" maxlength="25" value="<?php echo $ligne1['ct_prenom'];?> "/></td>
</tr>
<tr>
<td>Fonction :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="cf_fonction" placeholder="Fonction" maxlength="25" value="<?php echo $ligne1['cf_fonction'];?> "/></td>
<td>Fonction :</td>
<td><input type="text" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="ct_fonction" placeholder="Fonction" maxlength="25" value="<?php echo $ligne1['ct_fonction'];?> "/></td>
</tr>
<tr>
<td>Téléphone :</td>
<td><input type="tel" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="cf_tel" maxlength="10" placeholder="Numero de telephone" value="<?php echo $ligne1['cf_tel'];?> "/></td>
<td>Téléphone :</td>
<td><input type="tel" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="ct_tel" maxlength="10" placeholder="Numero de telephone" value="<?php echo $ligne1['ct_tel'];?> "/></td>
</tr>
<tr>
<td>Mobile :</td>
<td><input type="tel" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center"name="cf_mobile" maxlength="10" placeholder="Mobile" value="<?php echo $ligne1['cf_mobile'];?> " /></td>
<td>Mobile :</td>
<td><input type="tel" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="ct_mobile" maxlength="10" placeholder="Mobile" value="<?php echo $ligne1['ct_mobile'];?> "/></td>
</tr>
<tr>
<td>Adresse e-mail :</td>
<td><input type="email" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="cf_mail" maxlength="50" placeholder="Adresse e-mail" value="<?php echo $ligne1['cf_mail'];?> "/></td>
<td>Adresse e-mail :</td>
<td><input type="email" style="border-radius:5px;border:0px;background:#C5E5F4;text-align:center" name="ct_mail" maxlength="50" placeholder="Adresse e-mail" value="<?php echo $ligne1['ct_mail'];?> "/></td>
</tr>
</table>
</div>
<br/>
<input type="hidden" name="id" value="<?php echo $_POST['id']; ?>"/>
<input type="submit" href="transition.php" name="valider" value="Modifier"/>
</form>
<?php
}
?>
<br/>
<?php
//s'il y a modification et qu'on appuie sur le bouton "valider" alors on prend les variables du form pour les mettre dans la bdd en écrasant les anciennes sauvegardées
if(isset($_POST['valider'])){
//on récupère les valeurs entrées par l'utilisateur :
$id=$_POST['id'];
$intitule=$_POST['intitule'];
$detail=$_POST['detail'];
$contactCommercial=$_POST['contactCommercial'];
$date=$_POST['date'];
$rs=$_POST['rs'];
$siret=$_POST['siret'];
$codeAPENAF=$_POST['codeAPENAF'];
$TVAIntra=$_POST['TVAIntra'];
$adresse=$_POST['adresse'];
$ville=$_POST['ville'];
$cp=$_POST['cp'];
$rl_nom=$_POST['rl_nom'];
$rl_prenom=$_POST['rl_prenom'];
$rl_fonction=$_POST['rl_fonction'];
$rl_tel=$_POST['rl_tel'];
$rl_mobile=$_POST['rl_mobile'];
$rl_mail=$_POST['rl_mail'];
$cf_nom=$_POST['cf_nom'];
$cf_prenom=$_POST['cf_prenom'];
$cf_fonction=$_POST['cf_fonction'];
$cf_tel=$_POST['cf_tel'];
$cf_mobile=$_POST['cf_mobile'];
$cf_mail=$_POST['cf_mail'];
$ct_nom=$_POST['ct_nom'];
$ct_prenom=$_POST['ct_prenom'];
$ct_fonction=$_POST['ct_fonction'];
$ct_tel=$_POST['ct_tel'];
$ct_mobile=$_POST['ct_mobile'];
$ct_mail=$_POST['ct_mail'];
$sql = ("UPDATE client
SET id = '$id', intitule = '$intitule', detail = '$detail', contactCommercial = '$contactCommercial', date='$date', rs = '$rs', siret = '$siret',
codeAPENAF = '$codeAPENAF', TVAIntra = '$TVAIntra', adresse = '$adresse', ville = '$ville', cp = '$cp', rl_nom = '$rl_nom', rl_prenom = '$rl_prenom', rl_fonction = '$rl_fonction',
rl_tel = '$rl_tel', rl_mobile = '$rl_mobile', rl_mail = '$rl_mail', cf_nom = '$cf_nom', cf_prenom = '$cf_prenom', cf_fonction = '$cf_fonction', cf_tel = '$cf_tel', cf_mobile = '$cf_mobile',
cf_mail = '$cf_mail', ct_nom = '$ct_nom', ct_prenom = '$ct_prenom', ct_fonction = '$ct_fonction', ct_tel = '$ct_tel', ct_mobile = '$ct_mobile', ct_mail = '$ct_mail'
WHERE id='$id'");
mysql_query($sql) or die ('Erreur SQL!'.$sql.' '.mysql_error());
?>
<?php
}
mysql_close(); // On oubli pas de déconnecter la base de données
?>
<?php
}
//Redirection vers l'accueil sinon
else
{
header('Location: connexion.php');
exit;
}
?>
</html> |
Partager