Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zekena
/
Unit-calculator
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6e6630cc
authored
May 14, 2019
by
yuward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m
parent
d102e3f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
55 deletions
calc/categories/area.php
calc/categories/length.php
calc/categories/speed.php
calc/categories/volume.php
calc/categories/weight.php
calc/categories/area.php
View file @
6e6630cc
...
...
@@ -104,13 +104,31 @@ if ($_POST['submit']) {
Be able to input number from either box.-->
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Enter amount"
name=
"from_value"
value=
"
<?php
echo
$from_value
;
?>
"
/>
<label
for=
"Input"
class=
"Input-label"
>
Your entry
</label>
<select
name=
"from_unit"
>
<?php
echo
area_options
();
?>
<option
value=
"square_inches"
<?php
if
(
$from_unit
==
'square_inches'
)
{
echo
" selected"
;
}
?>
>
square inches
</option>
<option
value=
"square_feet"
<?php
if
(
$from_unit
==
'square_feet'
)
{
echo
" selected"
;
}
?>
>
square feet
</option>
<option
value=
"square_yards"
<?php
if
(
$from_unit
==
'square_yards'
)
{
echo
" selected"
;
}
?>
>
square yards
</option>
<option
value=
"square_miles"
<?php
if
(
$from_unit
==
'square_miles'
)
{
echo
" selected"
;
}
?>
>
square miles
</option>
<option
value=
"square_millimeters"
<?php
if
(
$from_unit
==
'square_millimeters'
)
{
echo
" selected"
;
}
?>
>
square millimeters
</option>
<option
value=
"square_centimeters"
<?php
if
(
$from_unit
==
'square_centimeters'
)
{
echo
" selected"
;
}
?>
>
square centimeters
</option>
<option
value=
"square_meters"
<?php
if
(
$from_unit
==
'square_meters'
)
{
echo
" selected"
;
}
?>
>
square meters
</option>
<option
value=
"square_kilometers"
<?php
if
(
$from_unit
==
'square_kilometers'
)
{
echo
" selected"
;
}
?>
>
square kilometers
</option>
<option
value=
"acres"
<?php
if
(
$from_unit
==
'acres'
)
{
echo
" selected"
;
}
?>
>
acres
</option>
<option
value=
"hectares"
<?php
if
(
$from_unit
==
'hectares'
)
{
echo
" selected"
;
}
?>
>
hectares
</option>
</select>
<br>
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
$to_value
;
?>
"
/>
<input
readonly
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
$to_value
;
?>
"
/>
<label
for=
"Input"
class=
"input-label"
>
Converted Result
</label>
<select
name=
"to_unit"
>
<?php
echo
area_options
();
?>
<option
value=
"square_inches"
<?php
if
(
$to_unit
==
'square_inches'
)
{
echo
" selected"
;
}
?>
>
square inches
</option>
<option
value=
"square_feet"
<?php
if
(
$to_unit
==
'square_feet'
)
{
echo
" selected"
;
}
?>
>
square feet
</option>
<option
value=
"square_yards"
<?php
if
(
$to_unit
==
'square_yards'
)
{
echo
" selected"
;
}
?>
>
square yards
</option>
<option
value=
"square_miles"
<?php
if
(
$to_unit
==
'square_miles'
)
{
echo
" selected"
;
}
?>
>
square miles
</option>
<option
value=
"square_millimeters"
<?php
if
(
$to_unit
==
'square_millimeters'
)
{
echo
" selected"
;
}
?>
>
square millimeters
</option>
<option
value=
"square_centimeters"
<?php
if
(
$to_unit
==
'square_centimeters'
)
{
echo
" selected"
;
}
?>
>
square centimeters
</option>
<option
value=
"square_meters"
<?php
if
(
$to_unit
==
'square_meters'
)
{
echo
" selected"
;
}
?>
>
square meters
</option>
<option
value=
"square_kilometers"
<?php
if
(
$to_unit
==
'square_kilometers'
)
{
echo
" selected"
;
}
?>
>
square kilometers
</option>
<option
value=
"acres"
<?php
if
(
$to_unit
==
'acres'
)
{
echo
" selected"
;
}
?>
>
acres
</option>
<option
value=
"hectares"
<?php
if
(
$to_unit
==
'hectares'
)
{
echo
" selected"
;
}
?>
>
hectares
</option>
</select>
<div
id=
"reset"
class=
"button"
>
<input
type=
"submit"
name=
"submit"
value=
"Submit"
/>
...
...
calc/categories/length.php
View file @
6e6630cc
...
...
@@ -164,13 +164,27 @@ function length_options(){
<input
id=
"from_value"
class=
"Input-text"
placeholder=
"Enter amount"
name=
"from_value"
value=
"
<?php
echo
$from_value
;
?>
"
/>
<label
for=
"Input"
class=
"Input-label"
>
Your entry
</label>
<label
for=
"input"
class=
"Input-label"
>
Your Entry
</label>
<select
id=
"from_unit"
name=
"from_unit"
>
<?php
echo
length_options
();
?>
<option
value=
"inches"
<?php
if
(
$from_unit
==
'inches'
)
{
echo
" selected"
;
}
?>
>
inches
</option>
<option
value=
"feet"
<?php
if
(
$from_unit
==
'feet'
)
{
echo
" selected"
;
}
?>
>
feet
</option>
<option
value=
"yards"
<?php
if
(
$from_unit
==
'yards'
)
{
echo
" selected"
;
}
?>
>
yards
</option>
<option
value=
"miles"
<?php
if
(
$from_unit
==
'miles'
)
{
echo
" selected"
;
}
?>
>
miles
</option>
<option
value=
"millimeters"
<?php
if
(
$from_unit
==
'millimeters'
)
{
echo
" selected"
;
}
?>
>
millimeters
</option>
<option
value=
"centimeters"
<?php
if
(
$from_unit
==
'centimeters'
)
{
echo
" selected"
;
}
?>
>
centimeters
</option>
<option
value=
"meters"
<?php
if
(
$from_unit
==
'meters'
)
{
echo
" selected"
;
}
?>
>
meters
</option>
<option
value=
"kilometers"
<?php
if
(
$from_unit
==
'kilometers'
)
{
echo
" selected"
;
}
?>
>
kilometers
</option>
</select>
<br>
<input
readonly
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
$to_value
;
?>
"
/>
<label
for=
"input"
class=
"input-label"
>
Converted result
</label>
<select
id =
"to_unit"
name=
"to_unit"
>
<?php
echo
length_options
();
?>
<option
value=
"inches"
<?php
if
(
$to_unit
==
'inches'
)
{
echo
" selected"
;
}
?>
>
inches
</option>
<option
value=
"feet"
<?php
if
(
$to_unit
==
'feet'
)
{
echo
" selected"
;
}
?>
>
feet
</option>
<option
value=
"yards"
<?php
if
(
$to_unit
==
'yards'
)
{
echo
" selected"
;
}
?>
>
yards
</option>
<option
value=
"miles"
<?php
if
(
$to_unit
==
'miles'
)
{
echo
" selected"
;
}
?>
>
miles
</option>
<option
value=
"millimeters"
<?php
if
(
$to_unit
==
'millimeters'
)
{
echo
" selected"
;
}
?>
>
millimeters
</option>
<option
value=
"centimeters"
<?php
if
(
$to_unit
==
'centimeters'
)
{
echo
" selected"
;
}
?>
>
centimeters
</option>
<option
value=
"meters"
<?php
if
(
$to_unit
==
'meters'
)
{
echo
" selected"
;
}
?>
>
meters
</option>
<option
value=
"kilometers"
<?php
if
(
$to_unit
==
'kilometers'
)
{
echo
" selected"
;
}
?>
>
kilometers
</option>
</select>
...
...
calc/categories/speed.php
View file @
6e6630cc
...
...
@@ -98,7 +98,7 @@ $speed_options = array(
$opt
=
optionize
(
$unit
);
echo
"<option value=
\"
{
$opt
}
\"
"
;
if
(
$_POST
[
$from_unit
]
==
$opt
)
{
echo
" selected"
;
echo
'selected="selected"'
;
}
echo
">
{
$unit
}
</option>"
;
}
...
...
@@ -107,15 +107,15 @@ $speed_options = array(
</div>
<div
class=
"entry"
>
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
float_to_string
(
$to_value
);
?>
"
/>
<input
readonly
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
float_to_string
(
$to_value
);
?>
"
/>
<label
for=
"Input"
class=
"input-label"
>
Converted Result
</label>
<select
name=
"to_unit"
>
<?php
foreach
(
$speed_options
as
$unit
)
{
$opt
=
optionize
(
$unit
);
echo
"<option value=
\"
{
$opt
}
\"
"
;
if
(
$
from_unit
==
$opt
)
{
echo
" selected"
;
if
(
$
_POST
[
$to_unit
]
==
$opt
)
{
echo
'selected="selected"'
;
}
echo
">
{
$unit
}
</option>"
;
}
...
...
calc/categories/volume.php
View file @
6e6630cc
...
...
@@ -58,9 +58,6 @@ $volume_options = array(
<meta
charset=
"utf-8"
>
<link
rel=
"stylesheet"
href=
"../css/simp-Volume.css"
/>
<title>
Convert Volume
</title>
<script>
alert
(
"If you want to calculate entries in batch click the side button"
);
</script>
</head>
<body>
...
...
@@ -111,37 +108,54 @@ $volume_options = array(
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Enter amount"
name=
"from_value"
value=
"
<?php
echo
$from_value
;
?>
"
/>
<label
for=
"Input"
class=
"Input-label"
>
Your entry
</label>
<select
name=
"from_unit"
>
<?php
foreach
(
$volume_options
as
$unit
)
{
$opt
=
optionize
(
$unit
);
echo
"<option value=
\"
{
$opt
}
\"
"
;
if
(
$from_unit
==
$opt
)
{
echo
" selected"
;
}
echo
">
{
$unit
}
</option>"
;
}
?>
<option
value=
"cubic_inches"
<?php
if
(
$from_unit
==
'cubic_inches'
)
{
echo
" selected"
;
}
?>
>
cubic inches
</option>
<option
value=
"cubic_feet"
<?php
if
(
$from_unit
==
'cubic_feet'
)
{
echo
" selected"
;
}
?>
>
cubic feet
</option>
<option
value=
"cubic_meters"
<?php
if
(
$from_unit
==
'cubic_meters'
)
{
echo
" selected"
;
}
?>
>
cubic meters
</option>
<option
value=
"cubic_centimeres"
<?php
if
(
$from_unit
==
'cubic_centimeters'
)
{
echo
" selected"
;
}
?>
>
cubic centimeters
</option>
<option
value=
"imperial_gallons"
<?php
if
(
$from_unit
==
'imperial_gallons'
)
{
echo
" selected"
;
}
?>
>
imperial gallons
</option>
<option
value=
"imperial_quarts"
<?php
if
(
$from_unit
==
'imperial_quarts'
)
{
echo
" selected"
;
}
?>
>
imperial quarts
</option>
<option
value=
"imperial_pints"
<?php
if
(
$from_unit
==
'imperial_pints'
)
{
echo
" selected"
;
}
?>
>
imperial pints
</option>
<option
value=
"imperial_cups"
<?php
if
(
$from_unit
==
'imperial_cups'
)
{
echo
" selected"
;
}
?>
>
imperial cups
</option>
<option
value=
"imperial_ounces"
<?php
if
(
$from_unit
==
'imperial_ounces'
)
{
echo
" selected"
;
}
?>
>
imperial ounces
</option>
<option
value=
"imperial_tablespoons"
<?php
if
(
$from_unit
==
'imperial_tablespoons'
)
{
echo
" selected"
;
}
?>
>
imperial tablespoons
</option>
<option
value=
"us_gallons"
<?php
if
(
$from_unit
==
'us_gallons'
)
{
echo
" selected"
;
}
?>
>
US gallons
</option>
<option
value=
"us_quarts"
<?php
if
(
$from_unit
==
'imperial_quarts'
)
{
echo
" selected"
;
}
?>
>
imperial quarts
</option>
<option
value=
"us_pints"
<?php
if
(
$from_unit
==
'imperial_pints'
)
{
echo
" selected"
;
}
?>
>
imperial pints
</option>
<option
value=
"us_cups"
<?php
if
(
$from_unit
==
'us_cups'
)
{
echo
" selected"
;
}
?>
>
US cups
</option>
<option
value=
"us_ounces"
<?php
if
(
$from_unit
==
'us_ounces'
)
{
echo
" selected"
;
}
?>
>
US ounces
</option>
<option
value=
"us_tablespoons"
<?php
if
(
$from_unit
==
'us_tablespoons'
)
{
echo
" selected"
;
}
?>
>
US tablespoons
</option>
<option
value=
"us_gallons"
<?php
if
(
$from_unit
==
'us_gallons'
)
{
echo
" selected"
;
}
?>
>
US gallons
</option>
<option
value=
"liters"
<?php
if
(
$from_unit
==
'liters'
)
{
echo
" selected"
;
}
?>
>
liters
</option>
<option
value=
"millimeters"
<?php
if
(
$from_unit
==
'millimeters'
)
{
echo
" selected"
;
}
?>
>
millimeters
</option>
</select>
</div>
<div
class=
"entry"
>
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
$to_value
;
?>
"
/>
<input
readonly
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
$to_value
;
?>
"
/>
<label
for=
"Input"
class=
"input-label"
>
Converted Result
</label>
<select
name=
"to_unit"
>
<?php
foreach
(
$volume_options
as
$unit
)
{
$opt
=
optionize
(
$unit
);
echo
"<option value=
\"
{
$opt
}
\"
"
;
if
(
$from_unit
==
$opt
)
{
echo
" selected"
;
}
echo
">
{
$unit
}
</option>"
;
}
?>
<option
value=
"cubic_inches"
<?php
if
(
$to_unit
==
'cubic_inches'
)
{
echo
" selected"
;
}
?>
>
cubic inches
</option>
<option
value=
"cubic_feet"
<?php
if
(
$to_unit
==
'cubic_feet'
)
{
echo
" selected"
;
}
?>
>
cubic feet
</option>
<option
value=
"cubic_meters"
<?php
if
(
$tounit
==
'cubic_meters'
)
{
echo
" selected"
;
}
?>
>
cubic meters
</option>
<option
value=
"cubic_centimeres"
<?php
if
(
$to_unit
==
'cubic_centimeters'
)
{
echo
" selected"
;
}
?>
>
cubic centimeters
</option>
<option
value=
"imperial_gallons"
<?php
if
(
$to_unit
==
'imperial_gallons'
)
{
echo
" selected"
;
}
?>
>
imperial gallons
</option>
<option
value=
"imperial_quarts"
<?php
if
(
$to_unit
==
'imperial_quarts'
)
{
echo
" selected"
;
}
?>
>
imperial quarts
</option>
<option
value=
"imperial_pints"
<?php
if
(
$to_unit
==
'imperial_pints'
)
{
echo
" selected"
;
}
?>
>
imperial pints
</option>
<option
value=
"imperial_cups"
<?php
if
(
$to_unit
==
'imperial_cups'
)
{
echo
" selected"
;
}
?>
>
imperial cups
</option>
<option
value=
"imperial_ounces"
<?php
if
(
$to_unit
==
'imperial_ounces'
)
{
echo
" selected"
;
}
?>
>
imperial ounces
</option>
<option
value=
"imperial_tablespoons"
<?php
if
(
$to_unit
==
'imperial_tablespoons'
)
{
echo
" selected"
;
}
?>
>
imperial tablespoons
</option>
<option
value=
"us_gallons"
<?php
if
(
$to_unit
==
'us_gallons'
)
{
echo
" selected"
;
}
?>
>
US gallons
</option>
<option
value=
"us_quarts"
<?php
if
(
$to_unit
==
'imperial_quarts'
)
{
echo
" selected"
;
}
?>
>
imperial quarts
</option>
<option
value=
"us_pints"
<?php
if
(
$to_unit
==
'imperial_pints'
)
{
echo
" selected"
;
}
?>
>
imperial pints
</option>
<option
value=
"us_cups"
<?php
if
(
$to_unit
==
'us_cups'
)
{
echo
" selected"
;
}
?>
>
US cups
</option>
<option
value=
"us_ounces"
<?php
if
(
$to_unit
==
'us_ounces'
)
{
echo
" selected"
;
}
?>
>
US ounces
</option>
<option
value=
"us_tablespoons"
<?php
if
(
$to_unit
==
'us_tablespoons'
)
{
echo
" selected"
;
}
?>
>
US tablespoons
</option>
<option
value=
"us_gallons"
<?php
if
(
$to_unit
==
'us_gallons'
)
{
echo
" selected"
;
}
?>
>
US gallons
</option>
<option
value=
"liters"
<?php
if
(
$to_unit
==
'liters'
)
{
echo
" selected"
;
}
?>
>
liters
</option>
<option
value=
"millimeters"
<?php
if
(
$to_unit
==
'millimeters'
)
{
echo
" selected"
;
}
?>
>
millimeters
</option>
</select>
</div>
<input
type=
"submit"
name=
"submit"
value=
"Submit"
/>
</form>
...
...
calc/categories/weight.php
View file @
6e6630cc
...
...
@@ -146,33 +146,31 @@ $mass_options = array(
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Enter amount"
name=
"from_value"
value=
"
<?php
echo
$from_value
;
?>
"
/>
<label
for=
"Input"
class=
"Input-label"
>
Your entry
</label>
<select
name=
"from_unit"
>
<?php
foreach
(
$mass_options
as
$unit
)
{
$opt
=
optionize
(
$unit
);
echo
"<option value=
\"
{
$opt
}
\"
"
;
if
(
$from_unit
==
$opt
)
{
echo
" selected"
;
}
echo
">
{
$unit
}
</option>"
;
}
?>
<option
value=
"ounces"
<?php
if
(
$from_unit
==
'ounces'
)
{
echo
" selected"
;
}
?>
>
ounces
</option>
<option
value=
"pounds"
<?php
if
(
$from_unit
==
'pounds'
)
{
echo
" selected"
;
}
?>
>
pounds
</option>
<option
value=
"stones"
<?php
if
(
$from_unit
==
'stones'
)
{
echo
" selected"
;
}
?>
>
stones
</option>
<option
value=
"long_tons"
<?php
if
(
$from_unit
==
'long_tons'
)
{
echo
" selected"
;
}
?>
>
long tons
</option>
<option
value=
"short_tons"
<?php
if
(
$from_unit
==
'short_tons'
)
{
echo
" selected"
;
}
?>
>
short tons
</option>
<option
value=
"milligrams"
<?php
if
(
$from_unit
==
'milligrams'
)
{
echo
" selected"
;
}
?>
>
milligrams
</option>
<option
value=
"grams"
<?php
if
(
$from_unit
==
'grams'
)
{
echo
" selected"
;
}
?>
>
grams
</option>
<option
value=
"kilograms"
<?php
if
(
$from_unit
==
'kilograms'
)
{
echo
" selected"
;
}
?>
>
kilograms
</option>
<option
value=
"metric_tonnes"
<?php
if
(
$from_unit
==
'metric_tonnes'
)
{
echo
" selected"
;
}
?>
>
metric tonnes
</option>
</select>
</div>
<div
class=
"entry"
>
<input
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
float_to_string
(
$to_value
);
?>
"
/>
<input
readonly
id=
"Input"
class=
"Input-text"
placeholder=
"Wait for it"
name=
"to_value"
value=
"
<?php
echo
float_to_string
(
$to_value
);
?>
"
/>
<label
for=
"Input"
class=
"input-label"
>
Converted Result
</label>
<select
name=
"to_unit"
>
<?php
foreach
(
$mass_options
as
$unit
)
{
$opt
=
optionize
(
$unit
);
echo
"<option value=
\"
{
$opt
}
\"
"
;
if
(
$from_unit
==
$opt
)
{
echo
" selected"
;
}
echo
">
{
$unit
}
</option>"
;
}
?>
<option
value=
"ounces"
<?php
if
(
$to_unit
==
'ounces'
)
{
echo
" selected"
;
}
?>
>
ounces
</option>
<option
value=
"pounds"
<?php
if
(
$to_unit
==
'pounds'
)
{
echo
" selected"
;
}
?>
>
pounds
</option>
<option
value=
"stones"
<?php
if
(
$to_unit
==
'stones'
)
{
echo
" selected"
;
}
?>
>
stones
</option>
<option
value=
"long_tons"
<?php
if
(
$to_unit
==
'long_tons'
)
{
echo
" selected"
;
}
?>
>
long tons/option>
<option
value=
"short_tons"
<?php
if
(
$to_unit
==
'short_tons'
)
{
echo
" selected"
;
}
?>
>
short tons
</option>
<option
value=
"milligrams"
<?php
if
(
$to_unit
==
'milligrams'
)
{
echo
" selected"
;
}
?>
>
milligrams
</option>
<option
value=
"grams"
<?php
if
(
$to_unit
==
'grams'
)
{
echo
" selected"
;
}
?>
>
grams
</option>
<option
value=
"kilograms"
<?php
if
(
$to_unit
==
'kilograms'
)
{
echo
" selected"
;
}
?>
>
kilograms
</option>
<option
value=
"metric_tonnes"
<?php
if
(
$to_unit
==
'metric_tonnes'
)
{
echo
" selected"
;
}
?>
>
metric tonnes
</option>
</select>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment