-
Notifications
You must be signed in to change notification settings - Fork 2
/
editForm2Back.php
122 lines (103 loc) · 7.1 KB
/
editForm2Back.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
session_start();
if (!isset($_SESSION['roll'])) {
header("location:teacherHome.php");
}
require_once './connect.php';
// $conn = mysqli_connect('localhost', 'root', '', 'student');
$val = $_SESSION['roll'];
$f_fname = $_POST['f_fname'];
$f_mname = $_POST['f_mname'];
$f_lname = $_POST['f_lname'];
$f_email = $_POST['f_email'];
$f_mob = $_POST['f_mob'];
$f_age = $_POST['f_age'];
$f_qua = $_POST['f_qua'];
$f_occ = $_POST['f_occ'];
// mother
$m_fname = $_POST['m_fname'];
$m_mname = $_POST['m_mname'];
$m_lname = $_POST['m_lname'];
$m_email = $_POST['m_email'];
$m_mob = $_POST['m_mob'];
$m_age = $_POST['m_age'];
$m_qua = $_POST['m_qua'];
$m_occ = $_POST['m_occ'];
// sib1
$s1_fname = $_POST['s1_fname'];
$s1_mname = $_POST['s1_mname'];
$s1_lname = $_POST['s1_lname'];
$s1_email = $_POST['s1_email'];
$s1_mob = $_POST['s1_mob'];
$s1_age = $_POST['s1_age'];
$s1_qua = $_POST['s1_qua'];
$s1_occ = $_POST['s1_occ'];
// sib2
$s2_fname = $_POST['s2_fname'];
$s2_mname = $_POST['s2_mname'];
$s2_lname = $_POST['s2_lname'];
$s2_email = $_POST['s2_email'];
$s2_mob = $_POST['s2_mob'];
$s2_age = $_POST['s2_age'];
$s2_qua = $_POST['s2_qua'];
$s2_occ = $_POST['s2_occ'];
// sib3
$s3_fname = $_POST['s3_fname'];
$s3_mname = $_POST['s3_mname'];
$s3_lname = $_POST['s3_lname'];
$s3_email = $_POST['s3_email'];
$s3_mob = $_POST['s3_mob'];
$s3_age = $_POST['s3_age'];
$s3_qua = $_POST['s3_qua'];
$s3_occ = $_POST['s3_occ'];
if(isset($_POST["editForm2"])) {
$query1 = "SELECT * FROM familiydetail WHERE std_rollno = '$val';";
$result = mysqli_query($conn, $query1);
$rowcount = mysqli_num_rows($result);
if($rowcount == 1) {
$query2 = "UPDATE familiydetail SET std_rollno = '$val', f_fname = '$f_fname', f_mname = '$f_mname', f_lname = '$f_lname', f_email = '$f_email', f_mob = '$f_mob', f_age = '$f_age', f_qua = '$f_qua', f_occ = '$f_occ', m_fname = '$m_fname', m_mname = '$m_mname', m_lname = '$m_lname', m_email = '$m_email', m_mob = '$m_mob', m_age = '$m_age', m_qua = '$m_qua', m_occ = '$m_occ', s1_fname = '$s1_fname', s1_mname = '$s1_mname', s1_lname = '$s1_lname', s1_email = '$s1_email', s1_mob = '$s1_mob', s1_age = '$s1_age', s1_qua = '$s1_qua', s1_occ = '$s1_occ', s2_fname = '$s2_fname', s2_mname = '$s2_mname', s2_lname = '$s2_lname', s2_email = '$s2_email', s2_mob = '$s2_mob', s2_age = '$s2_age', s2_qua = '$s2_qua', s2_occ = '$s2_occ', s3_fname = '$s3_fname', s3_mname = '$s3_mname', s3_lname = '$s3_lname', s3_email = '$s3_email', s3_mob = '$s3_mob', s3_age = '$s3_age', s3_qua = '$s3_qua', s3_occ = '$s3_occ' WHERE std_rollno = '$val';";
$result = mysqli_query($conn, $query2);
header("location:editForm2.php?form2=updated");
}else {
$query3 = "INSERT INTO familiydetail ( std_rollno , f_fname, f_mname, f_lname, f_email, f_mob, f_age, f_qua, f_occ, m_fname, m_mname, m_lname, m_email, m_mob, m_age, m_qua, m_occ, s1_fname, s1_mname, s1_lname, s1_email, s1_mob, s1_age, s1_qua, s1_occ, s2_fname, s2_mname, s2_lname, s2_email, s2_mob, s2_age, s2_qua, s2_occ, s3_fname, s3_mname, s3_lname, s3_email, s3_mob, s3_age, s3_qua, s3_occ) VALUES ('$val', '$f_fname', '$f_mname', '$f_lname', '$f_email', '$f_mob', '$f_age', '$f_qua', '$f_occ', '$m_fname', '$m_mname', '$m_lname', '$m_email', '$m_mob', '$m_age', '$m_qua', '$m_occ', '$s1_fname', '$s1_mname', '$s1_lname', '$s1_email', '$s1_mob', '$s1_age', '$s1_qua', '$s1_occ', '$s2_fname', '$s2_mname', '$s2_lname', '$s2_email', '$s2_mob', '$s2_age', '$s2_qua', '$s2_occ', '$s3_fname', '$s3_mname', '$s3_lname', '$s3_email', '$s3_mob', '$s3_age', '$s3_qua', '$s3_occ');";
mysqli_query($conn, $query3);
header("location:editForm2.php?form2=completed");
}
}
// FOR PDF
if(isset($_POST["mkpdf2"])) {
require_once __DIR__ . '/vendor/autoload.php';
//create new pdf instance
$mpdf = new \Mpdf\Mpdf();
$data = '';
$data .= '<h1>Family Details</h1>';
$data .= '<h4>Father's Information</h4>';
$data .= '<strong>• Name : </strong>'.$f_fname.' '.$f_mname.' '.$f_lname.'<br><br>';
$data .= '<strong>• Email : </strong>'.$f_email.' <strong>• Mobile No : </strong>'.$f_mob.' <strong>• Age : </strong>'.$f_age.'<br><br>';
$data .= '<strong>• Qualification : </strong>'.$f_qua.' <strong>• Occupation : </strong>'.$f_occ.'<br><br>';
$data .= '<hr><br><br>';
$data .= '<h4>Mother's Information</h4>';
$data .= '<strong>• Name : </strong>'.$m_fname.' '.$m_mname.' '.$m_lname.'<br><br>';
$data .= '<strong>• Email : </strong>'.$m_email.' <strong>• Mobile No : </strong>'.$m_mob.' <strong>• Age : </strong>'.$m_age.'<br><br>';
$data .= '<strong>• Qualification : </strong>'.$m_qua.' <strong>• Occupation : </strong>'.$m_occ.'<br><br>';
$data .= '<hr><br><br>';
$data .= '<h4>Sibling's Information</h4>';
$data .= '<h5>• sibling 1</h5>';
$data .= '<strong>• Name : </strong>'.$s1_fname.' '.$s1_mname.' '.$s1_lname.'<br><br>';
$data .= '<strong>• Email : </strong>'.$s1_email.' <strong>• Mobile No : </strong>'.$s1_mob.' <strong>• Age : </strong>'.$s1_age.'<br><br>';
$data .= '<strong>• Qualification : </strong>'.$s1_qua.' <strong>• Occupation : </strong>'.$s1_occ.'<br><br>';
$data .= '<hr>';
$data .= '<h5>• sibling 2</h5>';
$data .= '<strong>• Name : </strong>'.$s2_fname.' '.$s2_mname.' '.$s2_lname.'<br><br>';
$data .= '<strong>• Email : </strong>'.$s2_email.' <strong>• Mobile No : </strong>'.$s2_mob.' <strong>• Age : </strong>'.$s2_age.'<br><br>';
$data .= '<strong>• Qualification : </strong>'.$s2_qua.' <strong>• Occupation : </strong>'.$s2_occ.'<br><br>';
$data .= '<hr>';
$data .= '<h5>• sibling 3</h5>';
$data .= '<strong>• Name : </strong>'.$s3_fname.' '.$s3_mname.' '.$s3_lname.'<br><br>';
$data .= '<strong>• Email : </strong>'.$s3_email.' <strong>• Mobile No : </strong>'.$s3_mob.' <strong>• Age : </strong>'.$s3_age.'<br><br>';
$data .= '<strong>• Qualification : </strong>'.$s3_qua.' <strong>• Occupation : </strong>'.$s3_occ.'<br><br>';
$data .= '<hr>';
$mpdf->WriteHTML($data);
$mpdf->Output('FamilyDetails.pdf', 'D');
}
?>