Skip to main content
Flox Blog Beginner's Guide for Web Developers. 60% Off in Website Design & Development click here.

How to create simple blood donation management system in PHP code?

How to create simple blood donation management system in PHP code

In this example we will create a simple blood donation management system in core PHP code.

First you will create a folder in XAMPP Server like “online-blood-donation-system“. This is the folder of your project. Now create all sub folder like js, css, images etc. In my case i don’t use any JavaScript and Image, So i don’t create any folder related¬† to these name. One more thing i use bootstrap in my project so you will download the bootstrap.css file from internet.

Now we will start coding, so go to any text editor what you like and create a file name header.php and type the header html code.


<!doctype html>
<meta charset="utf-8">
<title>Online Blood Donation System</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="css/common.css" rel="stylesheet" type="text/css">

<header class="header_area_holder container-fluid text-center">
  <div class="row">
    	<div class="col-md-12">
        	<h1>Online Blood Donation System</h1>

Now we are create footer.php file.


<footer class="footer_area_holder container-fluid text-center">
	<div class="row">
    	<div class="col-md-12">
        	<p><a href="" target="_blank">Flox Blog</a> 2019.</p>

Then create index.php file.


<?php include 'header.php';?>
<section class="container_area_holder container-fluid home_area_holder">
  <div class="container">
    	<div class="row">
            <div class="col-md-2"></div>
            <div class="col-md-3 left">
                <a href="doner.php">Blood Doner</a>
            <div class="col-md-2"></div>
            <div class="col-md-3 right">
                <a href="receiver.php">Blood Receiver</a>
            <div class="col-md-2"></div>
<?php include 'footer.php';?>

Now you will see home page structure is ready for action. Then create a database in phpmyadmin. In my case the database name is php_blooddonor.


CREATE TABLE `donor` (
  `id` int(11) NOT NULL,
  `name` varchar(225) NOT NULL,
  `phone` varchar(225) NOT NULL,
  `blood_type` varchar(225) NOT NULL,
  `address` varchar(225) NOT NULL

Then create a database connection file in php. Name it config.php



Create a doner.php for insert data to the database or you called as form page.


  echo $_SESSION['msg'];
include 'header.php';
$sql="insert into donor(name,phone,blood_type,address) values('$name','$phone','$blood_type','$address')";
    echo $msg= "<span style='color:red';>registration sucessfull</span>";
     echo $msg="<span style='color:red'>Invalid UID / Token NO</span>";


<section class="container_area_holder doner_area_holder">
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <div class="form_holder">
          <form action="doner.php" method="post">
            <label>Blood Doner Form</label>
            <input type="text" placeholder="Name" name="name" id="nameid" required>
            <input type="tel" placeholder="Phone Number" name="phone" required>
            <select name="blood_type" required>
              <option>Select Blood Group</option>
              <option value="O+">O+</option>
              <option value="A+">A+</option>
              <option value="B+">B+</option>
              <option value="AB+">AB+</option>
              <option value="O-">O-</option>
              <option value="A-">A-</option>
              <option value="B-">B-</option>
              <option value="AB-">AB-</option>
            <textarea placeholder="Address" name="address"></textarea>
            <input type="submit" name="submit" value="Register">

<?php include 'footer.php';?>

Then you create a receiver.php for the list of all blood groups.


<?php include 'header.php';
<section class="container_area_holder receiver_area_holder">
  <div class="container">
    	<div class="row">
            <div class="col-md-3 box_1">
                <a href="recievercode.php?blood_group='O+'">O+</a>
            <div class="col-md-3 box_2">
                <a href="recievercode.php?blood_group='A+'">A+</a>
            <div class="col-md-3 box_3">
                <a href="recievercode.php?blood_group='B+'">B+</a>
            <div class="col-md-3 box_4">
                <a href="recievercode.php?blood_group='AB+'">AB+</a>
            <div class="col-md-3 box_5">
                <a href="recievercode.php?blood_group='<?php echo 'O-';?>'">O-</a>
            <div class="col-md-3 box_6">
                <a href="recievercode.php?blood_group='<?php echo 'A-';?>'">A-</a>
            <div class="col-md-3 box_7">
                <a href="recievercode.php?blood_group='<?php echo 'B-';?>'">B-</a>
            <div class="col-md-3 box_8">
                <a href="recievercode.php?blood_group='<?php echo 'AB-';?>'">AB-</a>

<?php include 'footer.php';?>

Create a recievercode.php file for display all name and data of a selected group peoples.


<?php include 'header.php';
<form method="post">
<table border="2">
    <th>Blood Type</th>
$sql="select * from donor where blood_type='$blood_group'";
while($row=mysqli_fetch_assoc($query)) : ?>
<?php endwhile; ?>

<?php include 'footer.php';?>

Now it’s time for styling code, so code is here.

@charset "utf-8";
/* CSS Document */
a{ text-transform:uppercase; text-decoration:none;}
td{ padding:10px;}
.header_area_holder{ background-color:#4058a5; color:#fff;}
.header_area_holder h1{font-size:25px; margin:0; padding:20px;}

.container_area_holder{ padding-bottom:44px; padding-top:20px;}
.home_area_holder{ text-align:center; padding-top:80px;}
.home_area_holder .col-md-3 a{ padding:90px 20px; display:block; text-transform:uppercase; color:#fff;}
.home_area_holder .col-md-3.left a{ background-color:#7813bf;}
.home_area_holder .col-md-3.right a{ background-color:#3094e1;}
.home_area_holder .col-md-3 a:hover{background-color:#202020;}

.receiver_area_holder .col-md-3{ text-align:center; margin-bottom:30px;}
.receiver_area_holder .col-md-3 a{ padding:50px 20px; display:block; background-color:#202020; color:#fff; font-weight:bold; font-size:23px;}
.receiver_area_holder .col-md-3.box_1 a{background-color:#e66565;}
.receiver_area_holder .col-md-3.box_2 a{background-color:#ce52cf;}
.receiver_area_holder .col-md-3.box_3 a{background-color:#8d52cf;}
.receiver_area_holder .col-md-3.box_4 a{background-color:#5255cf;}
.receiver_area_holder .col-md-3.box_5 a{background-color:#52b3cf;}
.receiver_area_holder .col-md-3.box_6 a{background-color:#8dcf52;}
.receiver_area_holder .col-md-3.box_7 a{background-color:#d3b342;}
.receiver_area_holder .col-md-3.box_8 a{background-color:#d37942;}
.receiver_area_holder .col-md-3 a:hover{background-color:#222222;}

table{margin: 0 auto; margin-top:50px;}

.form_holder{ max-width:500px; margin:0 auto;}
.doner_area_holder label{ text-align:center; font-weight:bold; font-size:25px; display:block;}
.doner_area_holder input,
.doner_area_holder select,
.doner_area_holder textarea{ display:block; width:100%; border:2px solid #CCC; padding:10px 20px; margin-bottom:20px;}
.doner_area_holder input[type="submit"]{ background-color:#4058a5; color:#fff; border-color:#4058a5; cursor:pointer;}
.footer_area_holder{ float:left; width:100%; position:absolute; bottom:0; left:0; background-color:#222222; color:#fff;}
.footer_area_holder p{ margin:0; padding:10px 0;}

create simple blood donation management system in PHP.

Then run the site in your localhost and test this. This is a simple php programmin every one understand what i am saying in this code. If you have any issue or any question then comment below and ask your question, i will deffenity answer your question.

If you area a WordPress developer or designer you will see my other post for more experience and improve your skills in development platform.

If you like my article please share with your friends. Thank You!!!.

Leave a Reply

Notify of