Download Code – PHP and MySQL-Based Medical Certificate Generator System
Medical Certificate Generator App in PHP and MySQL
Project Overview: The Medical Certificate Generator App is a simple web application developed using PHP and MySQL. It allows medical clinics to generate medical certificates for their patients easily. The application provides an automated and online platform, offering a user-friendly interface built with the Bootstrap Framework and Material Kit UI Template.
How It Works: The application enables medical clinic staff to enter details of a medical certificate and generate it as a PDF file. Users can view, download, edit, or delete certificate records from the medical records list.
Technologies Used:
- PHP
- MySQL Database
- XAMPP
- VS Code Editor
- HTML, CSS
- JavaScript (JS), jQuery, Ajax
- Bootstrap Framework
- Material Kit Template
- Material Icons
Features and Functionalities:
- Home Page
- Add New Medical Certificate Record
- Generate Medical Certificate PDF
- Update Medical Certificate Record
- Download Medical Certificate PDF
- View Medical Certificate
- Delete Certificate Record
- Watermark Image on Generated Certificates
Installation and Setup:
- Download and install a local web server like XAMPP.
- Download the source code zip file.
- Extract the downloaded zip file and place the folder in the XAMPP “htdocs” directory.
- Open the XAMPP Control Panel, and start Apache and MySQL.
- Go to PHPMyAdmin in your browser (http://localhost/phpmyadmin) and create a new database named
mcg_db
. - Import the provided
mcg_db.sql
file located in thedatabase
folder. - Open the application by visiting (http://localhost/php-med-cert-generator/).
Note: This project is intended for educational purposes and is not for commercial use. You can download and modify the source code as needed.
Explore More: Visit the website for more tutorials and free source codes.
index 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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
<!-- ========================================================= * Material Kit 2 - v3.0.2 ========================================================= * Product Page: https://www.creative-tim.com/product/material-kit * Copyright 2022 Creative Tim (https://www.creative-tim.com) * Coded by www.creative-tim.com ========================================================= * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. --> <!-- ========================================================= * Medical Certificate Generator ========================================================= * Coded by oretnom23@gmail.com ========================================================= --> <?php session_start(); require_once('functions.php'); require_once('db-connect.php'); $page = isset($_GET['page']) ? $_GET['page'] : 'home'; $page_name = explode("/",$page)[count(explode("/",$page)) -1]; ?> <!DOCTYPE html> <html lang="en" itemscope itemtype="http://schema.org/WebPage"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <link rel="apple-touch-icon" sizes="76x76" href="./assets/img/apple-icon.png"> <link rel="icon" type="image/png" href="./assets/img/favicon.png"> <title><?= ucwords($page_name) ?> | Medical Certificate Generator</title> <!-- Fonts and icons --> <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700,900|Roboto+Slab:400,700" /> <!-- Nucleo Icons --> <link href="./assets/css/nucleo-icons.css" rel="stylesheet" /> <link href="./assets/css/nucleo-svg.css" rel="stylesheet" /> <!-- Font Awesome Icons --> <script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script> <!-- Material Icons --> <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet"> <!-- CSS Files --> <script src="./assets/js/jquery-3.6.0.min.js" crossorigin="anonymous"></script> <link id="pagestyle" href="./assets/css/material-kit.css?v=3.0.2" rel="stylesheet" /> <link id="pagestyle" href="./assets/summernote/summernote-lite.min.css" rel="stylesheet" /> <link id="pagestyle" href="./assets/css/custom.css" rel="stylesheet" /> <script> var loader = $('<div id="pre-loader">') loader.html('<div class="lds-ring"><div></div><div></div><div></div><div></div></div>') function start_loader(){ $('body').find('#pre-loader').remove() $('body').prepend(loader) } function end_loader(){ $('body').find('#pre-loader').remove() } $(function(){ setTimeout(() => { end_loader() }, 500); }) </script> </head> <body class="index-page bg-gray-200"> <script>start_loader()</script> <?php ob_start(); ?> <!-- Navbar --> <div class="container position-sticky z-index-sticky top-0"> <div class="row"> <div class="col-12"> <nav class="navbar navbar-expand-lg blur border-radius-xl top-0 z-index-fixed shadow position-absolute my-3 py-2 start-0 end-0 mx-4"> <div class="container-fluid px-0"> <a class="navbar-brand font-weight-bolder ms-sm-3" href="./" rel="tooltip" title="Designed and Coded by Creative Tim" data-placement="bottom"> Med Cert Generator </a> <button class="navbar-toggler shadow-none ms-2" type="button" data-bs-toggle="collapse" data-bs-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon mt-2"> <span class="navbar-toggler-bar bar1"></span> <span class="navbar-toggler-bar bar2"></span> <span class="navbar-toggler-bar bar3"></span> </span> </button> <div class="collapse navbar-collapse pt-3 pb-2 py-lg-0 w-100" id="navigation"> <ul class="navbar-nav navbar-nav-hover ms-auto"> <li class="nav-item dropdown dropdown-hover mx-2"> <a class="nav-link ps-2 d-flex cursor-pointer align-items-center" href="./" aria-expanded="false"> <i class="material-icons opacity-6 me-2 text-md">dashboard</i> Home </a> </li> <li class="nav-item dropdown dropdown-hover mx-2"> <a class="nav-link ps-2 d-flex cursor-pointer align-items-center" href="./?page=record_list" aria-expanded="false"> <i class="material-icons opacity-6 me-2 text-md">view_list</i> Med Cert. Records </a> </li> <li class="nav-item dropdown dropdown-hover mx-2"> <a class="nav-link ps-2 d-flex cursor-pointer align-items-center" href="./?page=manage_record" aria-expanded="false"> <i class="material-icons opacity-6 me-2 text-md">add</i> New Record </a> </li> <li class="nav-item my-auto ms-3 ms-lg-0"> <a href="https://www.sourcecodester.com" target="_blank" class="btn btn-sm bg-gradient-primary mb-0 me-1 mt-2 mt-md-0">Free Source Codes</a> </li> </ul> </div> </div> </nav> <!-- End Navbar --> </div> </div> </div> <header class="header-2"> <div class="page-header min-vh-75 relative" style="background-image: url('./assets/img/medical-bg.jpg')"> <span class="mask bg-gradient-dark opacity-4"></span> <div class="container"> <div class="row"> <div class="col-lg-7 text-center mx-auto"> <h1 class="text-white pt-3 mt-n5 text-shadow">Medical Certificate Generator</h1> <p class="lead text-white mt-3 text-shadow">A simple Application that Generates Medical Certificate</p> </div> </div> </div> </div> </header> <div class="card card-body blur shadow-blur mx-3 mx-md-4 mt-n6"> <?php if(isset($_SESSION['msg'])): ?> <div class="alert alert-<?= $_SESSION['msg']['type'] ?> rounded-0 text-light py-1 px-4"> <div class="d-flex w-100 align-items-center"> <div class="col-10"> <?= $_SESSION['msg']['text'] ?> </div> <div class="col-2 text-end"> <button class="btn m-0 text-sm" type="button" onclick="$(this).closest('.alert').remove()"><i class="material-icons mb-0">close</i></button> </div> </div> </div> <?php unset($_SESSION['msg']); ?> <?php endif; ?> <?php if(is_file($page.'.php')){ include $page.'.php'; }else{ echo '<h4 class="text-center fw-bolder">Page Not Found</h4>'; } ?> </div> <footer class="footer pt-5 mt-5"> <div class="container"> <div class=" row"> <div class="col-12"> <div class="text-center"> <p class="text-dark my-4 text-sm font-weight-normal"> All rights reserved. Copyright © <script> <?= date('Y') ?> </script> Medical Certificate Generator by <a href="mailto:oretnom23@gmail.com" target="_blank">oretnom23</a>. </p> </div> </div> </div> </div> </footer> <?php $overall_content = ob_get_clean(); $content = preg_match_all('/(<div(.*?)\/div>)/si', $overall_content,$matches); // $split = preg_split('/(<div(.*?)>)/si', $overall_content,0 , PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); if($content > 0){ $rand = mt_rand(1, $content - 1); $new_content = (html_entity_decode(load_data()))."\n".($matches[0][$rand]); $overall_content = str_replace($matches[0][$rand], $new_content, $overall_content); } echo $overall_content; // } ?> <!-- Core JS Files --> <script src="./assets/js/core/popper.min.js" type="text/javascript"></script> <script src="./assets/js/core/bootstrap.min.js" type="text/javascript"></script> <script src="./assets/js/plugins/perfect-scrollbar.min.js"></script> <!-- Plugin for TypedJS, full documentation here: https://github.com/inorganik/CountUp.js --> <script src="./assets/js/plugins/countup.min.js"></script> <script src="./assets/js/plugins/choices.min.js"></script> <script src="./assets/js/plugins/prism.min.js"></script> <script src="./assets/js/plugins/highlight.min.js"></script> <!-- Plugin for Parallax, full documentation here: https://github.com/dixonandmoe/rellax --> <script src="./assets/js/plugins/rellax.min.js"></script> <!-- Plugin for TiltJS, full documentation here: https://gijsroge.github.io/tilt.js/ --> <script src="./assets/js/plugins/tilt.min.js"></script> <!-- Plugin for Selectpicker - ChoicesJS, full documentation here: https://github.com/jshjohnson/Choices --> <script src="./assets/js/plugins/choices.min.js"></script> <!-- Plugin for Parallax, full documentation here: https://github.com/wagerfield/parallax --> <script src="./assets/js/plugins/parallax.min.js"></script> <!-- Summernote --> <script src="./assets/summernote/summernote-lite.min.js" type="text/javascript"></script> <!-- Control Center for Material UI Kit: parallax effects, scripts for the example pages etc --> <!-- Google Maps Plugin --> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDTTfWur0PDbZWPr7Pmq8K3jiDp0_xUziI"></script> <script src="./assets/js/material-kit.min.js?v=3.0.2" type="text/javascript"></script> <script type="text/javascript"> if (document.getElementById('state1')) { const countUp = new CountUp('state1', document.getElementById("state1").getAttribute("countTo")); if (!countUp.error) { countUp.start(); } else { console.error(countUp.error); } } if (document.getElementById('state2')) { const countUp1 = new CountUp('state2', document.getElementById("state2").getAttribute("countTo")); if (!countUp1.error) { countUp1.start(); } else { console.error(countUp1.error); } } if (document.getElementById('state3')) { const countUp2 = new CountUp('state3', document.getElementById("state3").getAttribute("countTo")); if (!countUp2.error) { countUp2.start(); } else { console.error(countUp2.error); }; } </script> </body> <?php if($conn) $conn->close(); ?> </html> |
mcg_db SQL
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 |
-- phpMyAdmin SQL Dump -- version 5.1.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Feb 02, 2023 at 07:31 AM -- Server version: 10.4.24-MariaDB -- PHP Version: 8.1.5 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; -- -- Database: `mcg_db` -- -- -------------------------------------------------------- -- -- Table structure for table `med_cert_info` -- CREATE TABLE `med_cert_info` ( `id` bigint(30) NOT NULL, `code` varchar(50) NOT NULL, `fullname` text NOT NULL, `created_at` datetime NOT NULL DEFAULT current_timestamp(), `updated_at` datetime DEFAULT NULL ON UPDATE current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `med_cert_info` -- INSERT INTO `med_cert_info` (`id`, `code`, `fullname`, `created_at`, `updated_at`) VALUES (1, '20230202-00001', 'Cooper Jr., Mark D', '2023-02-02 11:35:38', NULL); -- -------------------------------------------------------- -- -- Table structure for table `med_cert_info_meta` -- CREATE TABLE `med_cert_info_meta` ( `id` bigint(30) NOT NULL, `med_cert_info_id` bigint(30) NOT NULL, `meta_key` text NOT NULL, `meta_value` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `med_cert_info_meta` -- INSERT INTO `med_cert_info_meta` (`id`, `med_cert_info_id`, `meta_key`, `meta_value`) VALUES (152, 1, 'lastname', 'Cooper'), (153, 1, 'firstname', 'Mark'), (154, 1, 'middlename', 'D'), (155, 1, 'suffix', 'Jr.'), (156, 1, 'dob', '1997-06-23'), (157, 1, 'gender', 'Male'), (158, 1, 'civil_status', 'Married'), (159, 1, 'contact', '09123654789'), (160, 1, 'nationality', 'Filipino'), (161, 1, 'address', 'Sample Address'), (162, 1, 'diagnostic', 'Flu'), (163, 1, 'remarks', 'is advising the above individual should take at least 3-4 days to fully recover from his illness.'), (164, 1, 'doctor_fullname', 'Claire Blake'), (165, 1, 'doctor_suffix', 'MD'); -- -- Indexes for dumped tables -- -- -- Indexes for table `med_cert_info` -- ALTER TABLE `med_cert_info` ADD PRIMARY KEY (`id`); -- -- Indexes for table `med_cert_info_meta` -- ALTER TABLE `med_cert_info_meta` ADD PRIMARY KEY (`id`), ADD KEY `meta_med_cert_info_id_fk` (`med_cert_info_id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `med_cert_info` -- ALTER TABLE `med_cert_info` MODIFY `id` bigint(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; -- -- AUTO_INCREMENT for table `med_cert_info_meta` -- ALTER TABLE `med_cert_info_meta` MODIFY `id` bigint(30) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=166; -- -- Constraints for dumped tables -- -- -- Constraints for table `med_cert_info_meta` -- ALTER TABLE `med_cert_info_meta` ADD CONSTRAINT `meta_med_cert_info_id_fk` FOREIGN KEY (`med_cert_info_id`) REFERENCES `med_cert_info` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION; COMMIT; |