IV Drip Rate Calculator

IV Drip Rate Calculator
This is a PHP file that I made that is compose of three types of calculators, specifically designed for calculating Intravenous (IV) Fluid infusion-related equations. One calculator is designed to get the amount of IV Fluid to infuse each hour. The second is designed to get the Drip Rate, while the final calculator is for getting the time to complete an infusion. This is a small project that I created for nurses and nurse-aspiring students.

Well, I used to be a nurse, but it seems my nursing days are over as I move into a new field now; a field so much different from the degree that I actually completed. Still, I understand how hard it is to study nursing so I think with the new fond field that I am in now, I might still be able to give little help to my nurse colleagues and future nurse colleagues.

Where is the IV Drip Rate Calculator?

The calculator is in PHP file format and runs in my server. To access the IV Drip Rate Calculator, click here.

The Source Code

IV Drip Rate Calculator Source Code

I’m distributing the source code so that not only would it benefit nurses but it would also benefit aspiring Web Developers and Programmers. As to how I manage to make it work, you can read my entry here. Note, you need to create two files for this one, a CSS file (yourfilename.css) and the PHP file (yourfilename.php). To project the same PHP function, just copy the codes below and put them in your PHP file. Note, however, that PHP files don’t run on your computer without a PHP Processor or a server emulator like XAMPP or WAMP. To make your PHP file mobile-friendly, you also need to copy the CSS code found after the PHP code and put it into a CSS file. Put the two files in the same folder. Use the tools that appear at the upper right portion of the code page (ie. View Source, Print) to copy or print the codes.

PHP File

<html>
<head>
<title>Your Page Title</title>
<meta name="description" content="Your Meta Description here example This page is IV Drip Rate Calculator." />
<meta name="robots" content="index,follow" />
<meta name="keywords" content="drip rate, drip rate calculation, drip rate calculator, drop factor, flow rate" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="yourfilename.css" type="text/css" media="all" />
</head>
<body>
<center><h1>IV Drip Rate Calculator</h1></center><br/>
<b>Legend:</b><br/><br/>
gtts - drops<br/>
min - minute<br/>
hr - hour<br/>
ml - milliliter<br/><br/>
<b>Calculator to get the amount to infuse each hour (ml/hr)</b><br/>
	<form action="?action=calcamtinfuse#amtinfuse" method="post">
		Amount of Solution to infuse: <input name="amtinfuse" type="number" step="any"> ml<br/>
		Number of Hours to infuse the solution: <input name="hr" type="number" step="any"> hr(s)<br/>
		<input name="calcamtinf" value="Calculate" type="submit">
	</form>
	<a name="amtinfuse"></a>
<?php
		if(isset($_GET['action'])=='calcamtinfuse#amtinfuse') {
			calcamtinfuse();
		}
	function calcamtinfuse() {
		if(isset($_POST['amtinfuse'])) { $infuseamt = $_POST['amtinfuse'];}
		if(isset($_POST['hr'])) { $hrs = $_POST['hr'];}
		if(isset($_POST['calcamtinf'])) {
			if(!empty($infuseamt) && ($hrs)) {
				if(is_numeric($_POST['amtinfuse']) && is_numeric($_POST['hr'])) {
					echo "<font color=#ff0000><b>ANS:</b></font> " . $infuseamt / $hrs . " ml/hr";
				}
			} else {
				echo "All fields must have a value!";
			}
		}
	}
?><br/><br/>
	<b>Calculator to get the amount to infuse each minute (gtts/min)</b><br/>
	<form action="?action=calcamtpermin#gttsmin" method="post">
		Amount of Solution per hour: <input name="amtsolhr" type="number" step="any"> ml<br/>
		Drops per ml (Drop Factor): <input name="dropfactor" type="number" step="any"> gtts/ml<br/>
		Time Period: <input name="time" type="number" step="any"> hr(s)<br/>
		<input name="calcamtpmin" value="Calculate" type="submit">
	</form>
	<a name="gttsmin"></a>
<?php
		if(isset($_GET['action'])=='calcamtpermin#gttsmin') {
			calcamtpermin();
		}
	function calcamtpermin() {
		if(isset($_POST['amtsolhr'])) { $amthr = $_POST['amtsolhr'];}
		if(isset($_POST['dropfactor'])) { $drpfactor = $_POST['dropfactor'];}
		if(isset($_POST['time'])) { $tmeframe = $_POST['time'];}
		if(isset($_POST['calcamtpmin'])) {
			if(!empty($amthr) && ($drpfactor) && ($tmeframe)) {
				if(is_numeric($_POST['amtsolhr']) && is_numeric($_POST['dropfactor']) && is_numeric($_POST['time'])) {
					echo "<font color=#ff0000><b>ANS:</b></font> " . ($amthr * $drpfactor) / ($tmeframe * 60) . " gtts/min";
				}
			} else {
				echo "All fields must have a value!";
			}
		}
	}
?><br/><br/>
	<b>Calculator to get the number of mins/hrs to complete an infusion</b><br/>
	<form action="?action=calcminhr#minhr" method="post">
		Amount of Solution: <input name="amsol" type="number" step="any"> ml<br/>
		Drops to infuse per minute (Drip Rate): <input name="driprate" type="number" step="any"> gtts/min<br/>
		Drops per ml (Drop Factor): <input name="drpftor" type="number" step="any"> gtts/ml<br/>
		<input name="calminhr" value="Calculate" type="submit">
	</form>
	<a name="minhr"></a>
<?php
		if(isset($_GET['action'])=='calcminhr#minhr') {
			calcminhr();
		}
	function calcminhr() {
		if(isset($_POST['amsol'])) { $ivsol = $_POST['amsol'];}
		if(isset($_POST['driprate'])) { $drrate = $_POST['driprate'];}
		if(isset($_POST['drpftor'])) { $drftor = $_POST['drpftor'];}
		if(isset($_POST['calminhr'])) {
			if(!empty($ivsol) && ($drrate) && ($drftor)) {
				if(is_numeric($_POST['amsol']) && is_numeric($_POST['drpftor']) && is_numeric($_POST['drpftor'])) {
					echo "<font color=#ff0000><b>ANS:</b></font> " . ($ivsol / $drrate) * $drftor  . " min(s) or " . ($ivsol / $drrate) * $drftor / 60 . " hr(s)";
				}
			} else {
				echo "All fields must have a value!";
			}
		}
	}
?><br/><br/>
</body>
</html>

CSS File

body {
	margin: 2px 5px 2px 5px;
}

@media screen and (min-width: 20em) {
	body, select, textarea {
		font-size: 20px;
	}
	form , button, input {
		margin: 2px 0 2px 0;
		font-size: 20px;
	}
}

@media screen and (min-width: 30em) {
	body, select, textarea {
		font-size: 18px;
	}
	form , button, input {
		margin: 2px 0 2px 0;
		font-size: 18px;
	}

@media screen and (min-width: 48em) {
	body, select, textarea {
		font-size: 18px;
	}
	form , button, input {
		margin: 2px 0 2px 0;
		font-size: 18px;
	}	
}
Follow me at:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.