commit existing workshops

This commit is contained in:
boris
2024-10-17 00:35:53 +01:00
parent 4070dc5367
commit ed02b435fe
74 changed files with 1083 additions and 91 deletions

18
workshop4/converter.php Executable file
View File

@@ -0,0 +1,18 @@
<?php
$view = new stdClass();
$view->pageTitle = 'Converter';
require_once('Models/Converter.php');
if(isset($_POST['submit'])) {
$converter = new Converter($_POST['number'],$_POST['fromUnit'],$_POST['toUnit']);
$value = $converter->convert();
if (!$value) {
$view->value = "Invalid Number";
}
else {
$view->result = $_POST['number'] . ' ' . $_POST['fromUnit'] . ' is ' . $value . ' ' . $_POST['toUnit'] . '.';
}
}
require_once('Views/converter.phtml');