-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.php
More file actions
125 lines (114 loc) · 3.66 KB
/
view.php
File metadata and controls
125 lines (114 loc) · 3.66 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
<?php
session_start();
// Database credentials
$hostname = 'your_hostname';
$username = 'your_username';
$password = 'your_password';
$database = 'your_database';
// Establish database connection
$conn = new mysqli($hostname, $username, $password, $database);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Retrieve the CV data from the database
$query = "SELECT * FROM cv_data ORDER BY id DESC LIMIT 1";
$result = $conn->query($query);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
// Extract the CV data
$fullName = $row['full_name'];
$dob = $row['dob'];
$placeOfBirth = $row['place_of_birth'];
$location = $row['location'];
$email = $row['email'];
$phoneNumber = $row['phone_number'];
$lastSchool = $row['last_school'];
$lastSchoolYear = $row['last_school_year'];
$lastSchoolGraduated = $row['last_school_graduated'];
$summary = $row['summary'];
$skills = $row['skills'];
$portrait = $row['portrait'];
// Retrieve the achievements from the database
$achievementsQuery = "SELECT achievement, year FROM achievements WHERE cv_data_id = " . $row['id'];
$achievementsResult = $conn->query($achievementsQuery);
$achievements = array();
while ($achievementRow = $achievementsResult->fetch_assoc()) {
$achievements[] = $achievementRow;
}
}
$conn->close();
?>
<!DOCTYPE html>
<html>
<head>
<title>CV Preview</title>
<style>
/* CSS styles for CV layout */
body {
font-family: Arial, sans-serif;
}
.cv-section {
margin-bottom: 20px;
}
.cv-section h2 {
margin-bottom: 5px;
}
.cv-section p {
margin: 0;
}
.cv-section ul {
margin: 0;
padding-left: 20px;
}
.cv-section ul li {
list-style-type: disc;
}
.portrait {
max-width: 200px;
}
</style>
</head>
<body>
<div class="cv-section">
<h2>Personal Information</h2>
<p><strong>Full Name:</strong> <?php echo $fullName; ?></p>
<p><strong>Date of Birth:</strong> <?php echo $dob; ?></p>
<p><strong>Place of Birth:</strong> <?php echo $placeOfBirth; ?></p>
<p><strong>Location:</strong> <?php echo $location; ?></p>
<p><strong>Email:</strong> <?php echo $email; ?></p>
<p><strong>Phone Number:</strong> <?php echo $phoneNumber; ?></p>
</div>
<div class="cv-section">
<h2>Last School</h2>
<p><strong>School Name:</strong> <?php echo $lastSchool; ?></p>
<p><strong>Year:</strong> <?php echo $lastSchoolYear; ?></p>
<p><strong>Graduated:</strong> <?php echo $lastSchoolGraduated; ?></p>
</div>
<div class="cv-section">
<h2>Achievements & Certifications</h2>
<ul>
<?php foreach ($achievements as $achievement) : ?>
<li><?php echo $achievement['achievement']; ?> (<?php echo $achievement['year']; ?>)</li>
<?php endforeach; ?>
</ul>
</div>
<div class="cv-section">
<h2>Summary</h2>
<p><?php echo $summary; ?></p>
</div>
<div class="cv-section">
<h2>Skills</h2>
<p><?php echo $skills; ?></p>
</div>
<div class="cv-section">
<h2>Portrait</h2>
<img class="portrait" src="<?php echo $portrait; ?>" alt="Portrait">
</div>
<form method="post" action="save_cv.php">
<input type="submit" name="save" value="Save">
</form>
<form method="post" action="download_cv.php">
<input type="submit" name="download" value="Download">
</form>
</body>
</html>