-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathumuganda_form4.php
98 lines (68 loc) · 2.65 KB
/
umuganda_form4.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
<!DOCTYPE html>
<html>
<head>
<title>insert</title>
<link rel="stylesheet" type="text/css" href="css/Style.css">
</head>
<body style="background-image: url(image/umuganda_them.PNG);">
<div class="header">
<h2>Register</h2>
</div>
<form method="post" action="" style="background-image: url(image/form.PNG);">
<?php
session_start(); // Session starts here.
if (isset($_POST['RESULT'])){
if (!empty($_SESSION['post'])){
if(empty($_POST['RESULT'])){
// Setting error message
$_SESSION['error_page3'] = "Some field(s) are missing, Please fill again";
header("location: umuganda_form3.php"); // Redirecting to first page
}
else {
// Fetching all values posted from second page and storing it in variable.
foreach ($_POST as $key => $value) {
$_SESSION['post'][$key] = $value;
}
extract($_SESSION['post']);
include 'connection.php';
$query = "INSERT INTO umuganda_project (PROVINCE,DISTRICT,SECTOR,CELL,VILLAGE,RECORD_DATE,GENDER,ID_NUMBER,FIRST_NAME,LAST_NAME,TELEPHONE,RESULT) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
$x = $db -> prepare($query);
$x->bindParam(':PROVINCE',$PROVINCE,PDO::PARAM_STR);
$x->bindParam(':DISTRICT',$DISTRICT,PDO::PARAM_STR);
$x->bindParam(':SECTOR',$SECTOR,PDO::PARAM_INT);
$x->bindParam(':CELL',$CELL,PDO::PARAM_STR);
$x->bindParam(':VILLAGE',$VILLAGE,PDO::PARAM_STR);
$x->bindParam(':RECORD_DATE',$RECORD_DATE,PDO::PARAM_STR);
$x->bindParam(':GENDER',$GENDER,PDO::PARAM_STR);
$x->bindParam(':ID_NUMBER',$ID_NUMBER,PDO::PARAM_STR);
$x->bindParam(':FIRST_NAME',$FIRST_NAME,PDO::PARAM_STR);
$x->bindParam(':LAST_NAME',$LAST_NAME,PDO::PARAM_STR);
$x->bindParam(':TELEPHONE',$TELEPHONE,PDO::PARAM_STR);
$x->bindParam(':RESULT',$RESULT,PDO::PARAM_STR);
$x -> execute(array($PROVINCE,$DISTRICT,$SECTOR,$CELL,$VILLAGE,$RECORD_DATE,$GENDER, $ID_NUMBER,$FIRST_NAME,$LAST_NAME,$TELEPHONE,$RESULT));
if ($x) {
echo '<h2> This User Added Successfull ..!! </h2>';
} else {
echo '<p> Submission Failed..!!</p>';
}
unset($_SESSION['post']); // Destroying session.
}
}
else {
header("location: umuganda_form1.php"); // Redirecting to first page.
}
}
else {
header("location: umuganda_form1.php"); // Redirecting to first page.
}
?>
</div>
<p style="color: #ffffff;">
Wanna Check_Data ?   <a onclick="return confirm('Are you sure!! You want to check users')" href="retrieve.php" style="color: #271c02; font-size: 20px; border: 10px; " >Check Now !!</a>
</p>
<p style="color: #ffffff;">
Wanna Register New Data !! ?   <a onclick="return confirm('Are you sure!! You want Register New user')" href="umuganda_form1.php" style="color: #271c02; font-size: 20px; border: 10px; " >Register Now !!</a>
</p>
</form>
</body>
</html>