Repository navigation
Expand file tree
/
Copy pathedit_user.php
More file actions
72 lines (63 loc) · 2.11 KB
/
Copy pathedit_user.php
File metadata and controls
72 lines (63 loc) · 2.11 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
<?php
include "db.php";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$userId = $_POST['userId'];
$userName = $_POST['userName'];
$userEmail = $_POST['userEmail'];
$userPw = $_POST['userPw'];
$sql = "UPDATE member SET user_pw = ?, user_name = ?, user_email = ? WHERE user_id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$userPw, $userName, $userEmail, $userId]);
?>
<script>
alert("회원 정보가 수정되었습니다.");
location.replace('./admin_users.php');
</script>
<?php
exit;
}
$userId = $_GET['userId'];
$sql = "SELECT * FROM member WHERE user_id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$userId]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>회원수정</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<main class="page">
<section class="card">
<h1>회원수정</h1>
<p class="desc">수정할 회원 정보를 입력하세요.</p>
<form action="edit_user.php" method="post">
<div class="form-group">
<label for="userId">아이디</label>
<input type="text" id="userId" name="userId" value="<?php echo $row['user_id']; ?>" readonly>
</div>
<div class="form-group">
<label for="userName">이름</label>
<input type="text" id="userName" name="userName" value="<?php echo $row['user_name']; ?>">
</div>
<div class="form-group">
<label for="userEmail">이메일</label>
<input type="email" id="userEmail" name="userEmail" value="<?php echo $row['user_email']; ?>">
</div>
<div class="form-group">
<label for="userPw">비밀번호</label>
<input type="password" id="userPw" name="userPw" placeholder="새 비밀번호 입력">
</div>
<button class="btn" type="submit">수정하기</button>
</form>
<p class="link-text">
<a href="admin_users.php">회원 목록으로</a>
</p>
</section>
</main>
</body>
</html>