-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmother.php
More file actions
141 lines (104 loc) · 4.7 KB
/
mother.php
File metadata and controls
141 lines (104 loc) · 4.7 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>mother registration</title>
</head>
<body>
<h1 align="center">REPUBLIC OF KENYA</h1>
<h2 align="center">3E BIRTHS AND DEATHS REGISTRATION ACT</h2>
<h3 align="center">(Cap. 149)</h3>
<h4 align="center">REGISTER OF BIRTH</h4>
<u><h5 align="left">mothers details</h5></u>
<div class="container-fluid">
<form action="" method="post" class="form-group">
<div>
<div class="row">
<div>
<label>FirstName:</label>
<input type="text" name="firstnamem" class="form-control" placeholder="Enter firstname" class="form-control" required/>
</div>
<div class="form-group">
<label>Middlename:</label>
<input type="text" name="middlename" class="form-control" placeholder="Enter secondname" class="form-control" required/>
</div>
<div class="form-group">
<label>Surname(fathers name or tribal):</label>
<input type="text" name="surname" class="form-control" placeholder="Enter surname" class="form-control" required/>
</div>
</div>
</div>
<div class="form-group">
<label>Age:</label>
<input type="int" name="age" placeholder="Age" class="form-control" required/>
</div>
<div >
<label >Is Mother married to Father: <label>
<label class="checkbox-inline"><input type="radio" name="married" value="Yes" />yes</label>
<label class="checkbox-inline"> <input type="radio" name="married" value="No" />No</label>
</div>
<div class="form-group">
<label>Residence:</label>
<input type="text" name="Residence"placeholder="Enter place of residence" class="form-control" required/>
</div>
<div class="form-group">
<div class="option">
<label>District:</label>
<select class="form-control" name="District">
<option>choose District</option>
<option>kericho</option>
<option>Nairobi</option>
<option>Kisumu</option>
<option>Mombasa</option>
<option>Machakos</option>
<option>Maseno</option>
</select>
</div>
</div>
<div class="form-group">
<label>Previous birth to mother of :</label>
Number born alive:<input type="int" name="nobornalive" placeholder="Number born alive" class="form-control"required/>
Number born dead:<input type="int" name="noborndead" placeholder="Number born dead" class="form-control"required/>
</div>
<input type="submit" name="submit" value="Save"/>
</form>
</div>
<?php
$conn= mysqli_connect("localhost", "root", "" )or die (mysqli_error());
mysqli_select_db ($conn, "health" )or die(mysqli_error());
if(isset($_POST['submit'])){
$firstnamem = $_POST['firstnamem'];
$middlename= $_POST['middlename'];
$surname = $_POST['surname'];
$age = $_POST['age'];
$married = $_POST['married'];
$residence = $_POST['Residence'];
$district = $_POST['District'];
$nobornalive = $_POST['nobornalive'];
$noborndead = $_POST['noborndead'];
if($firstnamem=''&&$middlename=''&& $surname=''&&$age=''&&$married=''&&$residence=''&&$district=''&&$nobornalive=''&&$noborndead=''){
echo '<script>window.alert("please fill the fields")</script>';
}else if($district=='choose District'){
echo'<script>window.alert("please choose apropriate hospital")</script>';
}else{
$sql = "INSERT INTO mother(Firstname, Middlename, Surname, Age, married, Sub_location, District, bornalive, borndead) values
('$firstnamem','$middlename','$surname','$age','$married','$residence', '$district','$nobornalive','$noborndead')" or die (mysql_error());
//$sql= "INSERT INTO `child`(`serial_no`, `Firstname`, `Othername`, `Surname`, `Date_of_birth`, `phone`, `Sex`, `Type_of_birth`, `Nature_of_birth`, `place_of_birth(hospital)`, `District`) VALUES
//([$serial_no],[$firstname],[$othername],[$surname],[$dob],[$phone],[$sex],[$typeofbirt],[$natureofbirt],[$placeofbirth],[$district])" or die (mysql_error());
if(mysqli_query( $conn, $sql)){
echo '<script type="text/javascript">';
echo 'window.alert("Records added successfully.");';
echo 'window.location.href="fathers.php";';
echo '</script>';
} else{
echo '<script>window.alert("ERROR: Could not able to execute $sql. ")</script>';
}
}
}
// close connection
mysqli_close($conn);
?>
</body>
</html>