-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathaddPerson.php
53 lines (50 loc) · 2.05 KB
/
addPerson.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
<?php
session_start();
$_SESSION["tab"] = "Add Person";
if($_SESSION["login"] != 1)
echo '<h2 txtcolor="red">Authentication Error!!!</h2>';
else{
include_once('header.php');
$name = $_POST['name'];
$phone = $_POST['phone'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$blood_group = $_POST['blood_group'];
$address = $_POST['address'];
$med_issues = $_POST['med_issues'];
$sql = "insert into Person (p_name,p_phone, p_dob, p_address, p_gender, p_blood_group, p_med_issues) values('$name', '$phone', '$dob', '$address', '$gender', '$blood_group', '$med_issues')";
if ($con->query($sql) === TRUE) {
$sql = "select p_id from Person where p_name ='$name' and p_phone = '$phone' and p_gender = '$gender' and p_dob = '$dob' and p_blood_group = '$blood_group' and p_address = '$address' and p_med_issues = '$med_issues'";
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
$count = mysqli_num_rows($result);
$pid = $row['p_id'];
}
else
echo "Error: " . $sql . "<br>" . $con->error;
###########contents of div goes here###########
if($count == 1){
echo'<h2>' .$name .'</h2><br><br>';
echo 'Your registration is succesful..<br><br>';
echo'Personal Id : '.$pid .'<br><br>';
echo'Name : '.$name .'<br><br>';
echo 'Phone Number: ' .$phone .'<br><br>';
echo 'DOB : ' .$dob .'<br><br>';
echo 'Blood Group : ' .$blood_group .'<br><br>';
echo 'Gender : ';
if ($gender === 'm')
echo 'Male<br><br>';
if ($gender === 'f')
echo 'Female<br><br>';
if ($gender === 'o')
echo 'Others<br><br>';
echo 'Address : ' .$address .'<br><br>';
echo 'Medical Issues : ';
if ($med_issues === "")
echo 'None<br><br>';
echo '<div style ="color:red;">NB:Please keep your Personal Id for future reference!!!';
}
##################################################
include_once('footer.php');
}
?>