<?php if ($_SERVER["REQUEST_METHOD"] == "POST") { $temperature = $_POST['temperature']; $unit = $_POST['unit']; $result = ''; if ($unit == 'C') { // Konwersja z Celsjusza $fahrenheit = ($temperature * 9/5) + 32; $kelvin = $temperature + 273.15; $result = "Fahrenheit: " . round($fahrenheit, 2) . " °F, Kelvin: " . round($kelvin, 2) . " K"; } elseif ($unit == 'F') { // Konwersja z Fahrenheita $celsius = ($temperature - 32) * 5/9; $kelvin = $celsius + 273.15; $result = "Celsjusz: " . round($celsius, 2) . " °C, Kelvin: " . round($kelvin, 2) . " K"; } else { // Konwersja z Kelwina $celsius = $temperature - 273.15; $fahrenheit = ($celsius * 9/5) + 32; $result = "Celsjusz: " . round($celsius, 2) . " °C, Fahrenheit: " . round($fahrenheit, 2) . " °F"; } echo "<div class='alert alert-success text-center'>Wynik: $result</div>"; } ?> </div> 