-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew_entite.php
More file actions
47 lines (37 loc) · 1.05 KB
/
new_entite.php
File metadata and controls
47 lines (37 loc) · 1.05 KB
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
<?php
require("Modeles/fonction.php");
require("includes/AccesBase.php");
if(!empty($_SESSION)){
$erreur="";
if(!empty($_POST['nom']) AND !empty($_POST['adresse']) AND ($_POST['listeDeroulante']!=0)){
$name = htmlspecialchars($_POST['nom']);
$adresse = htmlspecialchars($_POST['adresse']);
$typeEntite = htmlspecialchars($_POST['listeDeroulante']);
if(is_bool(entiteDisponible($db, $name)) && entiteDisponible($db, $name)==TRUE){
switch ($typeEntite) {
case '1':
$typeEntite = "Auto-école";
break;
case '2':
$typeEntite = "Centre de formation pour pilotes";
break;
default:
$typeEntite = "Auto-école";
break;
}
$req2 = insertEntite($db, $name, $adresse, $typeEntite);
$erreur="";
include('monEspace.php');
echo$new_boit;
}
else{
$erreur= "Cette entité existe déjà";
include('Vues/new_entite.vue.php');
}
}
else{
$erreur= "Veuillez remplir tous les champs";
include('Vues/new_entite.vue.php');
}
}
?>