-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit.php
66 lines (55 loc) · 2.47 KB
/
edit.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
<?php
include 'db/config.php';
if (isset($_POST['save'])) {
$id = $_POST['id'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
mysqli_query($conn, "UPDATE users SET first_name='$first_name',last_name='$last_name',email='$email',phone='$phone' WHERE id=$id");
header('location: index.php');
}
$result = mysqli_query($conn,"SELECT * FROM users WHERE id='" . $_GET['id'] . "'");
$row= mysqli_fetch_array($result);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Update Record</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<style type="text/css">
* {
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<div class="login">
<div class="account-login">
<h1>Update Record</h1>
<form action="edit.php" method="POST" class="login-form">
<input type="hidden" name="id" class="txtField" value="<?php echo $row['id']; ?>">
<div class="form-group">
<input type="text" placeholder="First Name" class="form-control" name="first_name" required="" value="<?php echo $row['first_name']; ?>">
</div>
<div class="form-group">
<input type="text" placeholder="Last Name" class="form-control" name="last_name" required="" value="<?php echo $row['last_name']; ?>">
</div>
<div class="form-group">
<input type="email" placeholder="Email" class="form-control" name="email" required="email" value="<?php echo $row['email']; ?>">
</div>
<div class="form-group">
<input type="phone" placeholder="Phone Number" class="form-control" name="phone" required="" value="<?php echo $row['phone']; ?>">
</div>
<button type="submit" class="btnsave" name="save">Save Record</button>
</form>
</div>
</div>
</body>
</html>