A simple program to ask the user to give a decimal value and then convert it into hexadecimal equivalent using PHP programming language.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
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.
Please subscribe to my channel https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg
=================================================
Want to support my channel?
GCash Account
Jake Pomperada
09173084360
Paypal
https://paypal.me/jakerpomperada
Patreon
https://www.patreon.com/jakerpomperada
Thank you very much for your support.
Program Listing
index.htm
<?php
$output = "";
if (isset($_POST["txtNumber"])) {
$output = '<div class="output">Hexadecimal Value = '.
dechex($_POST["txtNumber"]).
'</div>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Decimal To Hexadecimal In PHP</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: #eee;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: sans-serif;
}
form {
background: #fff;
padding: 30px;
border-radius: 10px;
}
h2 {
margin-bottom: 20px;
}
label,
input,
button {
display: block;
width: 100%;
font-size: 14px;
}
label {
padding: 5px 0;
}
input {
padding: 5px;
margin-bottom: 5px;
}
button {
padding: 8px 0;
background-color: #03a9f4;
border: none;
border-radius: 3px;
color: #fefefe;
cursor: pointer;
}
.output {
margin-top: 10px;
background-color: #607d8b;
padding: 12px 0;
color: #fefefe;
text-align: center;
}
</style>
</head>
<body>
<form action="" method="post">
<h1>Decimal To Hexadecimal In PHP</h1>
<h2>Jake R. Pomperada, MAED-IT, MIT</h2>
<label for="txtNumber">Enter a number to convert:</label>
<input type="number" name="txtNumber" id="txtNumber" value="<?= isset($_POST["txtNumber"])?$_POST["txtNumber"]:""; ?>" autofocus>
<button type="submit">Convert To Hexadecimal</button>
<?= $output; ?>
</form>
</body>
</html>