-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit.php
More file actions
118 lines (90 loc) · 5.28 KB
/
edit.php
File metadata and controls
118 lines (90 loc) · 5.28 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
if(isset($_GET['editCook'])){
$edit_cook = $_GET['editCook'];
}
$query= "SELECT * FROM cook WHERE cookID= $edit_cook ";
$result = mysqli_query($db,$query);
while($row=mysqli_fetch_assoc($result)){
$userID = $row['cookID'];
$image = $row['image'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$username = $row['username'];
$email =$row['email'];
$password = $row['password'];
$dob = $row['dob'];
$gender = $row['gender'];
$number = $row['mobile'];
$role = $row['role'];
}
if(isset($_POST['update_cook'])){
$firstname= $_POST['firstname'];
$lastname = $_POST['lastname'];
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$dob=$_POST['dob'];
$mobile = $_POST['mobile'];
$upload_image = $_FILES['image']['name'];
$upload_image_temp = $_FILES['image']['tmp_name'];
$send = move_uploaded_file($upload_image_temp,"upload/".$upload_image);
$password = md5($_POST['password']);
$update_query_cook= "UPDATE cook SET firstname='$firstname',lastname='$lastname',username='$username',email='$email',password='$password',dob='$dob',mobile='$mobile',image='$upload_image' WHERE cookID = $edit_cook ";
$update_result = mysqli_query($db,$update_query_cook);
if(! $update_result){
$message = "Query error";
}
else{
$message = "successfully updated";
}
}else{
$message = "";
}
?>
<div class="signin" id="signin">
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-3"></div>
<form action=" " method="post" enctype="multipart/form-data">
<div class="col-lg-6 col-md-6">
<h4 class="text-center"><?php echo $message; ?></h4>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon"><i class="fa fa-user" aria-hidden="true"></i> </span>
<input type="text" value="<?php echo $firstname;?>" name="firstname" class="form-control"aria-describedby="sizing-addon1" placeholder="First name" required>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon"><i class="fa fa-user" aria-hidden="true"></i> </span>
<input type="text" value="<?php echo $lastname;?>" name="lastname" class="form-control"aria-describedby="sizing-addon1" placeholder="Last name" required>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon"><i class="fa fa-users" aria-hidden="true"></i> </span>
<input type="text" value="<?php echo $username;?>" name="username" class="form-control"aria-describedby="sizing-addon1" placeholder="Username" required>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon"><i class="fa fa-envelope-o" aria-hidden="true"></i> </span>
<input type="email" value="<?php echo $email;?>" name="email" class="form-control"aria-describedby="sizing-addon1" placeholder="Email" required>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon"><i class="fa fa-lock" aria-hidden="true"></i> </span>
<input type="password" value="<?php echo $password;?>" name="password" class="form-control"aria-describedby="sizing-addon1" placeholder="Enter password" required>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon"><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span> </span>
<input type="date" value="<?php echo $dob;?>" class="form-control"aria-describedby="sizing-addon1" placeholder="Date" name="dob" required>
</div>
<div class="input-group input-group-lg">
<span class="input-group-addon" id="sizing-addon"><i class="fa fa-phone" aria-hidden="true"></i> </span>
<input type="number" value="<?php echo $mobile;?>" class="form-control"aria-describedby="sizing-addon1" placeholder="Number" name="mobile" size="10" maxlength="10" required>
</div>
<div class="input-group input-group-lg">
<img width="80" src="upload/<?php echo $image?>" alt=""><br />
<label>Upload image</label>
<input type="file" name="image" id="file" multiple accept="image/*">
</div>
<button type="submit" class="btn btn-primary" name="update_cook"><span class="glyphicon glyphicon-user"></span> Update cook</button>
</div>
</form>
<div class="col-lg-3 col-md-3"></div>
</div>
</div>
</div>