PHP Measurement Converter Project
PHP Measurement Converter Project
Project Report
On
“Measurement Converter”
Submitted to
Information Technology
Submitted by
1
Amrutvahini Polytechnic Sangamner,
Certificate
“Measurement Converter”
Information Technology
2
Program Name – Information Technology
Program Code – IT6I (0080)
Course Name – WBP
Course Code – 22619
“Measurement Converter”
Prof. M.S.Kurhe
3
Acknowledgement
We have taken efforts in this project. However, it would not have been
possible without the kind support and help of many individuals and
organization. We would to kind to extend our sincere thanks to all of them.
First and foremost, we want to thanks Prof. Chaudhary N.K H.O.D. (IT)
Amrutvahini polytechnic, Sangamner. For giving us an opportunity to work on
this project. We are highly indebted to Prof. M.S.Kurhe (Project guide) for her
guidance and constant supervision as well as for providing Necessary
information regarding the project & also for her support in the Project. We
would like to express our gratitude towards our parents & members of
Information Technology department for their kind co-operation and
encouragement which help us in completion of this our thanks and
appreciations also go to our colleague in developing the project and people
who have willingly helped us with their abilities.
4
INDEX
1 Rationale 6
2 Aim/Benefits 6
4 Literature Review 6
9 Applications 28
10 Conclusion 28
5
Micro-Project Report
MEASUREMENT CONVERTOR
1.0 Rational:-
Measurement Conversion is developed using PHP, CSS, and JavaScript. This
application converts different quantities like Area, Length, Weight, Temperature, volume, and
speed from one unit to another.
Talking about the features of this project, the application is designed to convert
entered numbers from one system/unit to another system/unit. Also, the design of this project
is pretty simple so that the user won’t find any difficulties while working on it. There is some
validation in the project which makes the project more realistic.
6
5.0 Actual methodology:-
CSS FILE:-
/*general*/
html{
height: 100%;
width: 100%;
margin: 0;
padding: 0;
body{
height: 100%;
width: 100%;
padding: 0;
background: #EEE;
#main-content{
width: 500px;
h1{
/*menu page*/
ul#measurement-types{
list-style-type: none;
margin: 1em 0;
7
padding: 0;
ul#measurement-types li{
height: auto;
margin: 0 0 10px 0;
padding: 0;
ul#measurement-types li a{
text-decoration: none;
color: black;
display: block;
background: white;
width: 180px;
ul#measurement-types li a:hover{
color: white;
background: #FDB912;
/*Conversion forms*/
form label{
display: inline-block;
width: 45px;
form input[type="text"]{
width: 80px;
font-size: 16px;
8
line-height: 16px;
form select{
margin: 1em 0;
font-size: 14px;
form input[type="submit"]{
font-size: 1em;
text-decoration: none;
color: black;
display: block;
background: white;
form input[type="submit"]:hover{
color: white;
background: #FDB912;
1. FRONT PAGE:-
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Measurement Conversion</title>
</head>
9
<body>
<div id="main-content">
<h1>Measurement Conversion</h1>
<ul id="measurement-types">
<li><a href="area.php">Area</a></li>
<li><a href="speed.php">Speed</a></li>
<li><a href="temperature.php">Temperature</a></li>
</ul>
</div>
</body>
</html>
2. FUNCTION:-
<?php
"meters" => 1,
10
);
"liters" => 1,
);
11
"short_tons" => 907.185,
"kilograms" => 1,
);
function optionize($string) {
return $string;
// Length
if(array_key_exists($from_unit, LENGTH_TO_METER)) {
} else {
if(array_key_exists($to_unit, LENGTH_TO_METER)) {
} else {
12
return "Unsupported unit.";
}}
return $new_value;
// Area
if(array_key_exists($from_unit, LENGTH_TO_METER)) {
} else {
if(array_key_exists($to_unit, LENGTH_TO_METER)) {
} else {
}}
return $new_value;
13
// Volume
if(array_key_exists($from_unit, VOLUME_TO_LITER)) {
} else {
if(array_key_exists($to_unit, VOLUME_TO_LITER)) {
} else {
return $new_value;
// Mass
if(array_key_exists($from_unit, MASS_TO_KILOGRAM)) {
} else {
14
function convert_from_kilograms($value, $to_unit) {
if(array_key_exists($to_unit, MASS_TO_KILOGRAM)) {
} else {
return $new_value;
// Speed
return $value;
// Temperature
switch($from_unit) {
case 'celsius':
return $value;
15
break;
case 'fahrenheit':
break;
case 'kelvin':
break;
default:
switch($to_unit) {
case 'celsius':
return $value;
break;
case 'fahrenheit':
break;
case 'kelvin':
break;
default:
16
return $new_value;
}?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Measurement Conversion</title>
</head>
<body>
<div id="main-content">
<h1>Measurement Conversion</h1>
<ul id="measurement-types">
<li><a href="area.php">Area</a></li>
<li><a href="speed.php">Speed</a></li>
<li><a href="temperature.php">Temperature</a></li>
</ul>
</div>
</body>
</html>
4. AREA:-
<!DOCTYPE html>
<html>
<head>
17
<meta charset="UTF-8">
<title>Convert Area</title>
</head>
<body>
<div id="main-content">
<h1>Convert Area</h1>
<div class="entry">
<label>From:</label>
<select name="from_unit">
<option value="acres">acres</option>
<option value="hectares">hectares</option>
</select>
</div>
<div class="entry">
<label>To:</label>
<select name="to_unit">
18
<option value="square_inches">square inches</option>
<option value="acres">acres</option>
<option value="hectares">hectares</option>
</select>
</div>
</form>
<br />
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Convert Volume</title>
</head>
<body>
19
<div id="main-content">
<h1>Convert Volume</h1>
<div class="entry">
<label>From:</label>
<select name="from_unit">
</div>
<div class="entry">
<label>To:</label>
<select name="to_unit">
20
value="cubic_centimeters">cubic centimeters</option><option value="cubic_meters">cubic
meters</option><option value="liters">liters</option><option
value="milliliters">milliliters</option> </select>
</div>
</form>
<br />
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Convert Mass</title>
</head>
<body>
<div id="main-content">
<h1>Convert Mass</h1>
<div class="entry">
<label>From:</label>
<select name="from_unit">
<option value="ounces">ounces</option><option
value="pounds">pounds</option><option value="stones">stones</option><option
value="long_tons">long tons</option><option value="short_tons">short
21
tons</option><option value="milligrams">milligrams</option><option
value="grams">grams</option><option value="kilograms">kilograms</option><option
value="metric_tonnes">metric tonnes</option> </select>
</div>
<div class="entry">
<label>To:</label>
<select name="to_unit">
<option value="ounces">ounces</option><option
value="pounds">pounds</option><option value="stones">stones</option><option
value="long_tons">long tons</option><option value="short_tons">short
tons</option><option value="milligrams">milligrams</option><option
value="grams">grams</option><option value="kilograms">kilograms</option><option
value="metric_tonnes">metric tonnes</option> </select>
</div>
</form>
<br />
</div>
</body>
</html>
7. SPEED:-
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Convert Speed</title>
</head>
<body>
22
<div id="main-content">
<h1>Convert Speed</h1>
<div class="entry">
<label>From:</label>
<select name="from_unit">
</div>
<div class="entry">
<label>To:</label>
<select name="to_unit">
</div>
</form>
<br />
</div>
</body>
</html>
8. TEMPRATURE:-
23
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Convert Temperature</title>
</head>
<body>
<div id="main-content">
<h1>Convert Temperature</h1>
<div class="entry">
<label>From:</label>
<select name="from_unit">
<option value="celsius">Celsius</option><option
value="fahrenheit">Fahrenheit</option><option value="kelvin">Kelvin</option>
</select>
</div>
<div class="entry">
<label>To:</label>
<select name="to_unit">
<option value="celsius">Celsius</option><option
value="fahrenheit">Fahrenheit</option><option value="kelvin">Kelvin</option>
</select>
</div>
</form>
<br />
24
<a href="index.php">Return to menu</a>
</div>
</body>
</html>
25
26
27
8.0 Skill Developed:-
1) Easy to use
Conclusion
28