-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.php
101 lines (93 loc) · 3.18 KB
/
update.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
<?php include("connection.php");?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<title>update</title>
</head>
<body>
<div class="container">
<form action="#" method="POST">
<div class="title">
updation form
</div>
<div class="form">
<div class="input_field">
<label>fname</label>
<input type="text" class="input" name="fname">
</div>
<div class="input_field">
<label>lname</label>
<input type="text" class="input" name="lname">
</div>
<div class="input_field">
<label>age</label>
<input type="text" class="input" name="age">
</div>
<div class="input_field">
<label>gender</label>
<select name="gender">
<option>male</option>
<option>female</option>
</select>
<div class="input_field">
<label>houseno</label>
<input type="text" class="input" name="houseno">
</div>
<div class="input_field">
<label>locality</label>
<input type="text" class="input" name="locality">
</div>
<div class="input_field">
<label>city</label>
<input type="text" class="input" name="city">
</div>
<div class="input_field">
<label>state</label>
<input type="text" class="input" name="state">
</div>
<div class="input_field">
<label>pincode</label>
<input type="text" class="input" name="pincode">
</div>
<div class="input_field">
<label>submit</label>
<input type="submit" value="register" class="btn" name="register">
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
<?php
if($_POST['register'])
{
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$age = $_POST['age'];
$gender = $_POST['gender'];
$houseno = $_POST['houseno'];
$locality = $_POST['locality'];
$city = $_POST['city'];
$state = $_POST['state'];
$pincode = $_POST['pincode'];
if ($fname != "" && $lname != "" && $age != "" && $gender != "" && $houseno != "" && $locality != "" && $city != "" && $state != "" && $pincode != "") {
$query = "INSERT INTO donor values('','$fname','$lname','$age','$gender','$houseno','$locality','$city','$state','$pincode')";
$data = mysqli_query($conn, $query);
if ($data) {
echo "data inserted into database";
} else {
echo "failed";
}
}
else
{
echo "<script>alert('Fields are empty');</script>";
}
}
?>