Convert From Feet to Kilometers Using PHP Script Code With HTML

Hello Friends Today, through this tutorial, I will tell you How can i Convert From Feet to kilometers Using PHP Script Code With HTML.

Certainly! Here’s a simple PHP script with HTML to create a feet to kilometers converter:

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Feet to Kilometers Converter</title>
<h2>Feet to Kilometers Converter</h2>
// Function to convert feet to kilometers
function feetToKilometers($feet) {
$kilometers = $feet * 0.0003048;
return $kilometers;
// Check if the form is submitted
// Get input value from the form
$feet = $_POST["feet"];
// Validate the input
if (is_numeric($feet)) {
// Convert feet to kilometers
$kilometers = feetToKilometers($feet);
echo "<p>$feet feet is equal to $kilometers kilometers.</p>";
} else {
echo "<p>Please enter a valid numeric value for feet.</p>";
<form method="post" action="">
<label for="feet">Enter Feet:</label>
<input type="text" name="feet" id="feet" required>
<input type="submit" value="Convert">

This script includes a simple HTML form with a text input for entering feet and a submit button. The PHP code checks if the form has been submitted, validates the input, and then converts the feet to kilometers using the `feetToKilometers` function. The result is displayed below the form.