From af249f2bc82336a796a9fb9ca648f40df9303b12 Mon Sep 17 00:00:00 2001 From: CXM <chenzixin202209@163.com> Date: Mon, 11 Mar 2024 14:48:29 +0000 Subject: [PATCH] fix the problem when change user profile, cause the user info is depends on the table that include student's info --- Presentation/settings.php | 57 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/Presentation/settings.php b/Presentation/settings.php index d52c631..603ca46 100644 --- a/Presentation/settings.php +++ b/Presentation/settings.php @@ -323,35 +323,31 @@ $user = $stmt->fetch(PDO::FETCH_ASSOC); <div id="logo">UWE Student Assistant</div> </div> - <form action="settings.php" method="post" id="editForm" enctype="multipart/form-data"> - <div class="card"> - <div class="avatar"> - <img src="getimage.php?userId=<?php echo htmlspecialchars($userId); ?>" alt="User Avatar"> - </div> - <div class="input-group"> - <label for="name">Name:</label> - <input type="text" id="name" name="name" value="<?php echo htmlspecialchars($user['user_Name']); ?>"> - </div> - <div class="input-group"> - <label for="email">Email:</label> - <input type="text" id="email" name="email" value="<?php echo htmlspecialchars($user['email']); ?>"> - </div> - <div class="input-group"> - <label for="major">Major:</label> - <input type="text" id="major" name="major" value="<?php echo htmlspecialchars($user['user_Major']); ?>"> - </div> - <div class="input-group"> - <label for="year">Enrollment Year:</label> - <input type="text" id="year" name="year" - value="<?php echo htmlspecialchars($user['enrollment_Year']); ?>"> - </div> - <input type="hidden" name="formType" value="UserForm"> - <!-- 隐藏字段用于在提交表单时传递userid--> - <input type="hidden" name="userId" value="<?php echo htmlspecialchars($userId); ?>"> - <button type="submit" class="button">Save Changes</button> - <button class="button" onclick="openAvaModal(event)">Change Avatar</button> + <div class="card"> + <div class="avatar"> + <img src="getimage.php?userId=<?php echo htmlspecialchars($userId); ?>" alt="User Avatar"> </div> - </form> + <div class="input-group"> + <label for="name">Name:</label> + <input type="text" id="name" name="name" value="<?php echo htmlspecialchars($user['user_Name']); ?>" + disabled> + </div> + <div class="input-group"> + <label for="email">Email:</label> + <input type="text" id="email" name="email" value="<?php echo htmlspecialchars($user['email']); ?>" disabled> + </div> + <div class="input-group"> + <label for="major">Major:</label> + <input type="text" id="major" name="major" value="<?php echo htmlspecialchars($user['user_Major']); ?>" + disabled> + </div> + <div class="input-group"> + <label for="year">Enrollment Year:</label> + <input type="text" id="year" name="year" + value="<?php echo htmlspecialchars($user['enrollment_Year']); ?>" disabled> + </div> + <button class="button" onclick="openAvaModal(event)">Change Avatar</button> + </div> <!-- 模态框 --> <form action="settings.php" method="post" enctype="multipart/form-data"> @@ -375,12 +371,13 @@ $user = $stmt->fetch(PDO::FETCH_ASSOC); <h2>Account Information</h2> <div class="input-group"> <label for="username">User Account:</label> - <input type="text" id="username" name="account" value="<?php echo htmlspecialchars($user['account']); ?>"> + <input type="text" id="username" name="account" value="<?php echo htmlspecialchars($user['account']); ?>" + disabled> </div> <div class="input-group"> <label for="password">Password:</label> <input type="password" id="password" name="password" - value="<?php echo htmlspecialchars($user['password']); ?>"> + value="<?php echo htmlspecialchars($user['password']); ?>" disabled> <button class="toggle-btn" onclick="togglePasswordVisibility()">👁</button> </div> <button class="modern-button" onclick="openModal()">Edit Your Info</button> -- GitLab