-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathedit.php
More file actions
100 lines (75 loc) · 2.56 KB
/
edit.php
File metadata and controls
100 lines (75 loc) · 2.56 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
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
<?php
if(!isset($_GET['id'])){
header("Location:index.php");
}
require "header.php";
include_once("db.php");
$nameEr="Entrez un nouveau nom ";
$emailEr="Entrez un nouveau email";
if (isset($_POST['update'])) {
$id = mysqli_real_escape_string($mysqli, $_POST['id']);
$name = mysqli_real_escape_string($mysqli, $_POST['name']);
$email = mysqli_real_escape_string($mysqli, $_POST['email']);
if (empty($name) || empty($email)) {
if (empty($name)) {
$nameEr = "<span style=\"color:red;\">Name is empty<span>";
};
if (empty($email)) {
$emailEr = "<span style=\"color:red;\">email is empty<span>.";
};
}else {
$result = mysqli_query($mysqli, "UPDATE etudiant SET name='$name',email='$email' WHERE id=$id");
header("Location: index.php");
}
}
?>
<?php
$id = $_GET['id'];
$result = mysqli_query($mysqli, "SELECT * FROM etudiant WHERE id=$id");
while ($res = mysqli_fetch_array($result)) {
$name = $res['name'];
$email = $res['email'];
}
?>
<body>
<section>
<div class="container-fluid mt-4">
<div class="row d-flex justify-content-center align-items-center ">
<div class="col-xl-5 col-md-5">
<div class="card rounded-3 text-black">
<div class="row g-0">
<div class="col-lg-12">
<div class="card-body p-md-5 mx-md-4">
<div class="text-center">
<img src="img/img.png" style="width: 185px;" alt="logo">
<h4 class="mt-1 mb-5 pb-1">mettre à jour
<span style="color:orange ;"><?php echo $name; ?></span> information</h4>
</div>
<form class="form" action="edit.php" method="post" name="form1">
<p>update Account Panel</p>
<div class="form-outline mb-4">
<input type="text" class="form-control" id="name" placeholder=" mettre à jour
le nom" name="name" value="<?php echo $name; ?>">
<label class="form-label" for="name"><?php echo "$nameEr";?></label>
</div>
<div class="form-outline mb-4">
<input type="email" name="email" id="emaill" class="form-control" value="<?php echo $email; ?>"></td>
<label class="form-label" for="emaill"><?php echo "$emailEr";?></label>
</div>
<div class="text-center pt-1 mb-5 pb-1">
<input type="hidden" name="id" value=<?php echo $_GET['id']; ?>>
<input type="submit" name="update" class="form-control btn btn-primary" value="Update">
</div>
<div class="d-flex align-items-center justify-content-center pb-4">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</body>
</html>