-
Notifications
You must be signed in to change notification settings - Fork 1
/
edit.php
executable file
·102 lines (72 loc) · 2.14 KB
/
edit.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
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
<?php
session_start();
if (isset($_SESSION['login']) && $_SESSION['login']) {
// var_dump($_SESSION);
} else {
header('Location:http://localhost/lab3/login.php');
}
require_once 'header.php';
include_once 'db.php';
$data = null;
$user_id =$_GET['id'];
$user_id = $link->real_escape_string($user_id);
$query = "SELECT * FROM userform WHERE id=$user_id";
$result = $link->query($query);
$num_result = $result->num_rows;
if ($num_result > 0) {
while ($rows = $result->fetch_assoc()) {
$data[] = $rows;
}
}
//var_dump($data);
?>
<style>
input[type=text], select {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=submit] {
width: 100%;
background-color: red;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
div {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
</style>
<div>
<form action="http://localhost/lab3/update.php" method="POST">
<label for="name">Name </label>
<input type="text" id="name" name="name" placeholder="Full name" value="<?php echo $data[0]['name']?>">
<label for="email"> Email </label>
<input type="text" id="email" name="email" placeholder="Email" value="<?php echo $data[0]['email']?>">
<label for="carno"> carno </label>
<input type="text" id="carno" name="carno" placeholder="carno" value="<?php echo $data[0]['carno']?>">
<label for="appdate">Appoinment date</label>
<input type="text" id="appdate" name="appdate" placeholder="Change Appoinment Date.." value="<?php echo $data[0]['appdate']?>">
<label for="mechanic">Mechanics Name</label>
<select id="mechanic" name="mechanic">
<option value="mia">Mia</option>
<option value="misha">Misha</option>
<option value="rahim">Rahim</option>
<option value="karim">Karim</option>
</select>
<input type="submit" value="Submit">
</form>
</div>
<?php require_once 'footer.php'; ?>