-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_e.php
139 lines (133 loc) · 6 KB
/
add_e.php
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
<?php
include('fonction.php');
if(isset($_GET['key']) && test_id($_GET['key'])){
if(!isset($_GET['semaine']))$s = date('W', time());
else if(isset($_GET['semaine'][7]))$s = $_GET['semaine'][6].$_GET['semaine'][7];
else $s = $_GET['semaine'];
include('log_bdd.php');
// INSERTION rdv : INSERT INTO `rdv` (`id`, `nom`, `date`, `durre`, `couleur`, `id_elleve`, `id_proph`) VALUES (NULL, 'test_rdv_bdd', '2021-12-10 16:00:00', '60', '#FF00FF', '1', '1');
// Ecriture de la requête
if(isset($_POST['Envoyer'])){
$query=$pdo->prepare("INSERT INTO elleve (nom, prenom, mail, classe) VALUES (:n, :p, :m, :c)");
$query->bindValue(':n', $_POST['nom'], PDO::PARAM_STR);
$query->bindValue(':p', $_POST['prenom'], PDO::PARAM_STR);
$query->bindValue(':m', $_POST['mail'], PDO::PARAM_STR);
$query->bindValue(':c', $_POST['class'], PDO::PARAM_STR);
$query->execute();
$query->CloseCursor();
}
if(isset($_POST['Modifier'])){
$query=$pdo->prepare("UPDATE elleve SET nom = :n , prenom = :p , mail = :m, classe = :c WHERE id = :id");
$query->bindValue(':n', $_POST['nom'], PDO::PARAM_STR);
$query->bindValue(':p', $_POST['prenom'], PDO::PARAM_STR);
$query->bindValue(':c', $_POST['class'], PDO::PARAM_STR);
$query->bindValue(':m', $_POST['mail'], PDO::PARAM_STR);
$query->bindValue(':id', $_POST['id'], PDO::PARAM_INT);
$query->execute();
$query->CloseCursor();
}
if(isset($_POST['Supprimer'])){
$queryy=$pdo->prepare("DELETE FROM `rdv` WHERE id_elleve = :id");
$queryy->bindValue(':id', $_POST['id'], PDO::PARAM_INT);
$queryy->execute();
$queryy->CloseCursor();
$query=$pdo->prepare("DELETE FROM `elleve` WHERE id = :id");
$query->bindValue(':id', $_POST['id'], PDO::PARAM_INT);
$query->execute();
$query->CloseCursor();
}
?>
<html>
<head>
<title>EDT-Ajouter eleves</title>
<style type="text/css">
.head {
background-color: #006600 !important;
color: white !important;
font-size: 1.5vw !important;
font-family: Arial, "Arial Black", Times, "Times New Roman", serif !important;
border:1px solid red !important;
text-align: center !important;
}
td{
border-top: 1px solid black !important;
font-size: 1.3vw !important;
border-bottom: 1px solid black !important;
border-collapse: collapse !important;
padding-top: 1vw !important;
padding-bottom: 1vw !important;
padding-right: 0.3vw !important;
font-weight: bold !important;
}
tr{
background-color: #b9edc3;
}
table{
width: 100% !important;
}
</style>
<link rel="stylesheet" href="all.css" />
<script>
</script>
</head>
<body>
<h3>AJOUTER / MODIFIER UNE FICHE ELEVE :</h3>
<form method="post" action="">
<label for="nom">nom</label> <input type="text" name="nom" id="nom" value="Nom"/><br />
<label for="prenom">prenom</label> <input type="text" name="prenom" id="prenom" value="Prenom"/><br />
<label for="class">classe</label> <input type="text" name="class" id="class" value="classe"/><br />
<label for="mail">mail</label> <input type="mail" name="mail" id="mail" value="[email protected]"/><br />
<input type="submit" name="Envoyer" value="Envoyer" />
</form>
</br></br>
<form action="index.php?key=<?php echo($_GET['key']);?>&semaine=<?php echo($s);?>" method="POST">
<button>RETOUR ACCUEIL</button>
</form>
<?php
$sqlqueryy = "SELECT * FROM `elleve` ORDER BY `nom`";
$recipesStatementt = $pdo->prepare($sqlqueryy);
$recipesStatementt->execute();
$recipess = $recipesStatementt->fetchAll();
echo('<table cellspacing="0" cellpadding="0">');
echo('<tr style="padding-right: 0vw; width : 30vw" class="head">
<td>Nom</td>
<td>Prenom</td>
<td>Mail</td>
<td>Classe</td>
</tr>');
foreach ($recipess as $ress){
$id='';
if(isset($_GET['id']) && $_GET['id']==$ress['id']){
$id = 'id="position"';
}
echo('<tr '.$id.'>
<td onclick="location.href=\'?id='.$ress['id'].'&key='.$_GET['key'].'&semaine='.$s.'#position\'" >'.$ress['nom'].'</td>
<td onclick="location.href=\'?id='.$ress['id'].'&key='.$_GET['key'].'&semaine='.$s.'#position\'" >'.$ress['prenom'].'</td>
<td onclick="location.href=\'?id='.$ress['id'].'&key='.$_GET['key'].'&semaine='.$s.'#position\'" >'.$ress['mail'].'</td>
<td onclick="location.href=\'?id='.$ress['id'].'&key='.$_GET['key'].'&semaine='.$s.'#position\'" >'.$ress['classe'].'</td>
</tr>');
if(isset($_GET['id']) && $_GET['id']==$ress['id']){
echo('<tr>
<td colspan="3">
<form method="post" action="">
<label for="nom">nom</label> <input type="text" name="nom" id="nom" value="'.$ress['nom'].'"/><br />
<label for="prenom">prenom</label> <input type="text" name="prenom" id="prenom" value="'.$ress['prenom'].'"/><br />
<label for="class">classe</label> <input type="text" name="class" id="class" value="'.$ress['classe'].'"/><br />
<label for="mail">mail</label> <input type="mail" name="mail" id="mail" value="'.$ress['mail'].'"/><br />
<input type="HIDDEN" name = "id" value="'.$ress['id'].'"/>
<input type="submit" name="Modifier" value="Modifier" />
</form>
</td>
<td>
<form method="post" action="">
<input type="HIDDEN" name = "id" value="'.$ress['id'].'"/>
<input type="submit" name="Supprimer" value="Supprimer" />
</form>
</td>
</tr>');
}
}
echo('</table>');
}?>
</body>
</html>