backup
This commit is contained in:
18
php-s1/workshop4/converter.php
Executable file
18
php-s1/workshop4/converter.php
Executable 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');
|
Reference in New Issue
Block a user