-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_profile.php
More file actions
109 lines (88 loc) · 3.86 KB
/
admin_profile.php
File metadata and controls
109 lines (88 loc) · 3.86 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
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ADMIN HOME - APATH</title>
<link rel="stylesheet" href="apath.css">
</head>
<body>
<div class="container">
<h1>APATH</h1>
<?php
$current_page = basename($_SERVER['PHP_SELF']);
include "a_nav.php";
?>
<?php
// Commenting out database connection and query code
/*
if (!isset($_SESSION['user_id'])) {
die("User ID is not set in the session.");
}
$id = $_SESSION['user_id']; // Use session variable for user ID
echo "The ID of this user is " . $id . "<br>";
include "connection.php";
$sqs = "SELECT * FROM users WHERE id=$id";
echo "SQL statement is: " . $sqs . "<br>"; // Debugging
$result = mysqli_query($dbc, $sqs);
if ($result && mysqli_num_rows($result) == 1) {
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
$dbid = $row["id"];
$dblastname = htmlspecialchars($row["lastname"]);
$dbfirstname = htmlspecialchars($row["firstname"]);
$dbgender = htmlspecialchars($row["gender"]);
$dbaffiliation = htmlspecialchars($row["affiliation"]);
$dbemail = htmlspecialchars($row["email"]);
$dbphone = htmlspecialchars($row["phone"]);
$dbpw = htmlspecialchars($row["pw"]);
$dbpw2 = htmlspecialchars($row["pw2"]);
} else {
die("Something is wrong! User not found.");
}
*/
// Placeholder values for form fields
$dblastname = "Johnson";
$dbfirstname = "Carol";
$dbgender = "Female";
$dbaffiliation = "Jason";
$dbemail = "";
$dbphone = "";
?>
<h2>Display Admin Profile Form</h2>
<form action="admin_edit.php" method="post">
<div class="form-group">
<label for="lastname">Last Name:</label>
<input type="text" id="lastname" name="lastname" value="<?php echo $dblastname; ?>" required>
<br><br>
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="firstname" value="<?php echo $dbfirstname; ?>" required>
<br><br>
<label for="level">Gender:</label>
<br>
<input type="radio" name="level" value="Male" <?php if ($dbgender == "Male") echo "checked"; ?>> Male <br>
<input type="radio" name="level" value="Female" <?php if ($dbgender == "Female") echo "checked"; ?>> Female <br>
<input type="radio" name="level" value="Other" <?php if ($dbgender == "Other") echo "checked"; ?>> Other <br><br>
<label for="affiliation">Affiliation/Recommended By:</label>
<input type="text" id="affiliation" name="affiliation" value="<?php echo $dbaffiliation; ?>" required>
<br><br>
<label for="email">Email Address:</label>
<input type="email" id="email" name="email" value="<?php echo $dbemail; ?>" required>
<br><br>
<label for="phone">Phone Number:</label>
<input type="text" id="phone" name="phone" value="<?php echo $dbphone; ?>" required>
<br><br>
<label for="password1">Password:</label>
<input type="password" id="password1" name="password1" maxlength="30">
<br><br>
<label for="password2">Confirm Password:</label>
<input type="password" id="password2" name="password2" maxlength="30">
<br><br>
<button type="submit">Submit</button>
</div>
</form>
</div>
</body>
</html>