My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com
If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.
Your support on my channel is highly appreciated.
* {
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
background: url("double-bubble-outline.png") #fefefe repeat;
color: #1a1a1a;
font-size: 15px;
}
main {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 500px;
box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
border-radius: 10px;
}
.container {
display: block;
padding: 30px;
background: #fff;
text-align: left;
border-radius: 2px;
}
h1, h2 {
text-align: center;
}
label {
width: 100%;
}
input,
select {
display: inline-block;
background: #f5f5f5;
width: 100%;
margin: 5px 0 20px 0;
padding: 15px;
border: none;
font-size: 15px;
}
input:focus,
select:focus {
background: #eeeeee;
outline: none;
}
.btnReset,
button {
background: #2196f3;
color: #fff;
padding: 15px;
margin: 0 0 20px;
border: none;
cursor: pointer;
width: 100%;
opacity: 0.9;
font-size: 15px;
outline: none;
border:0;
}
.btnWrapper {
display: flex;
margin: 0 0 20px;
}
.btnReset {
background: #4caf50;
}
.btnReset,
.btnConvert {
width: 50%;
display: inline-block;
text-align: center;
text-decoration: none;
margin: 0;
}
.btnSelectShape {
background: #f44336;
}
.btnReset:hover,
button:hover {
opacity: 1;
}
.answer {
width: 100%;
padding: 20px;
text-align: center;
font-size: 30px;
font-weight: bold;
background: #dadada;
font-family: 'Times New Roman', serif;
line-height: 1.5;
}
.visibility_on {
display: block;
}
.visibility_off {
display: none;
}
.frmTempSelect {
display: flex;
flex-flow: row wrap;
align-items: center;
}
.frmTempSelect select {
vertical-align: middle;
padding: 15px;
margin: 5px 0 0;
width: calc(100% - 100px);
}
.frmTempSelect button {
width: 100px;
margin: 5px 0 0;
}
.pieText {
font-family: Serif;
}
.blueText {
color:#2196f3;
}
<?php
/* Temperature Converter in PHP
Mr. Jake Rodriguez Pomperada, MAED-IT, MIT
www.jakerpomperada.com / www.jakerpomperada.blogspot.com
jakerpomperada@gmail.com
Bacolod City, Negros Occidental Philippines
*/
$area = $html = $infotext = $sel1 = $sel2 = $sel3 = "";
$num1 = isset($_POST['txtNum1']) ? floatval($_POST['txtNum1']) : "";
$visibility = "visibility_off";
$frmArea = isset($_GET['selectArea']) ? $_GET['selectArea'] : '';
// Display selected shape input fields
if(isset($_GET['selectArea'])) {
$visibility = "visibility_on";
switch ($frmArea) {
case "ctof":
$sel1 = "selected";
$html = '<h2>Celsius → Fahrenheit Converter</h2>
<label for="txtNum1"><b>Input Temparature in ℃:</b></label>
<input type="number" name="txtNum1" id="txtNum1" value="'.$num1.'" required>';
if(isset($_POST['btnConvert'])) {
$temp = round((($num1 * (9/5))+32), 2);
$infotext = '<div class="answer">(<span class="blueText">'.$num1.'</span> x <sup>9</sup>⁄<sub>5</sub>) + 32 = '.$temp.' ℉</div>';
}
break;
case "ftoc":
$sel2 = "selected";
$html = '<h2>Fahrenheit → Celsius Converter</h2>
<label for="txtNum1"><b>Input Temparature in ℉:</b></label>
<input type="number" name="txtNum1" id="txtNum1" value="'.$num1.'" required>';
if(isset($_POST['btnConvert'])) {
$temp = round((($num1 - 32) * (5/9)), 2);
$infotext = '<div class="answer">(<span class="blueText">'.$num1.'</span> - 32) x <sup>5</sup>⁄<sub>9</sub> = '.$temp.' ℃</div>';
}
break;
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Temperature Converter in PHP</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<main>
<div class="container">
<h1>Temperature Converter in PHP</h1>
<h2>Mr. Jake R. Pomperada, MAED-IT, MIT</h2>
</div>
<div class="container">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" class="frmTempSelect">
<label for="selectArea"><b>Select Unit of Temperature:</b></label>
<select name="selectArea" id="selectArea" value="<?php echo $oper; ?>" required>
<option value="ctof" <?php echo $sel1; ?>>Celsius → Fahrenheit</option>
<option value="ftoc" <?php echo $sel2; ?>>Fahrenheit → Celsius</option>
</select>
<button type="submit" class="btnSelectShape">Select</button>
</form>
</div>
<div class="container <?php echo $visibility; ?>">
<form action="" method="post" class="frmAreaCalculate">
<?php echo $html; ?>
<div class="btnWrapper">
<a href="index.php" type="button" name="btnReset" class="btnReset">Reset</a>
<button type="submit" name="btnConvert" class="btnConvert">Convert</button>
</div>
<?php echo $infotext; ?>
</form>
</div>
</main>
</body>
</html>
No comments:
Post a Comment