-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_user_details.php
executable file
·59 lines (51 loc) · 1.36 KB
/
edit_user_details.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
<?php
session_start();
if(!isset($_POST['submit']))
{
$nm=$_SESSION['name'];
$ph=$_SESSION['phone'];
$uid=$_SESSION['id'];
}
else
{
$nw_nm=$_POST['name'];
$nw_ph=$_POST['cont'];
$nm=$nw_nm;
$ph=$nw_ph;
$uid=$_SESSION['id'];
$connection=mysqli_connect("localhost","root","","ttatva15");
$nw_nm=mysqli_real_escape_string($connection,$nw_nm);
$query="UPDATE users SET name = '$nw_nm', phone = '$nw_ph' WHERE uid = $uid;";
$result=mysqli_query($connection,$query);
if(!$result)
{
die ("<h2>Database Query Failed</h2>");
}
else
{
echo "<h2>User details successfully updated.</h2>";
}
mysqli_close($connection);
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
type="text/css"
href="style.css">
<title>Edit User</title>
</head>
<body>
<center>
<form style=" font-size: 25px; font-family: sans-serif; " action="edit_user_details.php" method="POST">
Name:<br>
<input type="text" style=" height: 25px; " name="name" value="<?php echo htmlspecialchars($nm)?>" required><br>
Contact No. : (Numeric Only)<br>
<input type="text" style=" height: 25px; " pattern="[0-9]*" name="cont" value="<?php echo htmlspecialchars($ph)?>" required><br>
<button type ="submit" class="button" style="padding: 10px 15px;" name="submit">Submit</button>
</form>
</center>
</body>
</html>
<header></header>