-
Notifications
You must be signed in to change notification settings - Fork 0
/
trait.php
102 lines (79 loc) · 3.19 KB
/
trait.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
<?php
if (isset($_POST["cin"]) && !empty($_POST["cin"])) {
$cin =$_POST["cin"];
$nom =$_POST["nom"];
$prenom =$_POST["prenom"];
$email =$_POST["email"];
$telephone =$_POST["telephone"];
$date =$_POST["date"];
$car=$_POST["car"];
echo $date;
$sexe=$_POST["optionsRadios"];
}
$html ="
<head>
<!-- Latest compiled and minified CSS -->
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'
integrity='sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T' crossorigin='anonymous'>
<script src='https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'
integrity='sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM'
crossorigin='anonymous'></script>
<body>
<h3 align='center'>Achat réusssite pour $prenom $nom</h3>
";
echo "$html" ;
$html ="
<table border ='1' align='center' >
<caption> Listes des achat </caption>
<thead>
<tr>
<th>CIN</th>
<th>NOM</th>
<th>PRENOM</th>
<th>DateNaissance</th>
<th>EMAIL</th>
<th>TELEPHONE</th>
<th>GENRE</th>
<th>Voiture</th>
<th>Modif</th>
<th>Supp</th>
</tr>
</thead>
";
echo "$html" ;
// Connection à la base de données
$conn = mysqli_connect('localhost', 'root', '', 'agencewfbd');
if (!$conn) {
die('Could not connect to MySQL: ' . mysqli_connect_error());
}
//Préparation de requête
$req = "INSERT INTO achat (`cin`, `nom`, `prenom`, `email`, `telephone`, `date`, `sexe`, `car`) VALUES ('$cin', '$nom', '$prenom', '$email', '$telephone', '$date', '$sexe','$car');";
mysqli_query ($conn,$req);
//mysqli_close($conn);
$result = mysqli_query($conn, 'SELECT * FROM achat');
// Exécution de requête
while (($row = mysqli_fetch_array($result)) != NULL) {
echo '
<tr>
<td>' . $row["cin"] . '</td>
<td>' . $row["nom"] . '</td>
<td>' . $row["prenom"] . '</td>
<td>' . $row["email"] . '</td>
<td>' . $row["telephone"] . '</td>
<td>' . $row["date"] . '</td>
<td>' . $row["sexe"] . '</td>
<td>' . $row["car"] . '</td>
<td><a href=\'modifier.php?cin='. $row["cin"] .'\'><img src=\'modifier.jpg\' width=\'30\' > modifier</a></td>
<td><a href=\'traitSuppression.php?cin='. $row["cin"] .'\'><img src=\'supprimer.jpg\' width=\'30\' > supprimer</a></td>
</tr>
';
}
echo "</table>
<br>
<center><a href='index.html'> ajouter un autre achat </a></center>
";
// Libération de ressource reservé (optionnel)
mysqli_free_result($result);
// Fermeture de connection (optionnel)
mysqli_close($conn);
?>