-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupd_t.php
More file actions
29 lines (24 loc) · 963 Bytes
/
Copy pathupd_t.php
File metadata and controls
29 lines (24 loc) · 963 Bytes
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
<?php
// Assuming you have already established a database connection
// Check if the search button is clicked
if(isset($_GET['search'])) {
// Get the username from the textbox
$username = $_GET['username'];
// Prepare the SQL statement to retrieve user information based on the username
$sql = "SELECT * FROM users WHERE username = :username";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':username', $username);
$stmt->execute();
// Fetch the user information
$user = $stmt->fetch(PDO::FETCH_ASSOC);
// Display the user information
echo 'Username: ' . $user['username'] . '<br>';
echo 'Email: ' . $user['email'] . '<br>';
echo 'Age: ' . $user['age'] . '<br>';
}
?>
<!-- HTML form with a textbox and a button -->
<form method="GET" action="">
<input type="text" name="username" placeholder="Enter username">
<input type="submit" name="search" value="Search">
</form>