HTML5
Этот тег группирует элементы в форме.
<?
php
class Electro {
private $show0;
private $show1;
private $price;
function __construct($arg0, $arg1, $arg2) {
$this->show0 = $arg0;
$this->show1 = $arg1;
$this->price = $arg2;
}
function Res() {
return $this->show1 - $this->show0;
function Sum() {
return round( $this->price * $this->Res(), 2);
?>
<!DOCTYPE html>
<
html
>
head
meta
charset
=
"utf-8"
/>
title
>Name Page</
</
body
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$
show0
abs
((int)$_POST['show0']);
show1
((int)$_POST['show1']);
$price = (float)$_POST['price'];
E
new
Electro($show0, $show1, $price);
if($_REQUEST['clear']) {
null
;
price
form
id
"form1"
action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
fieldset
legend
>To calculate electricity</
br
input
type
"text"
name
"show0"
value="<?php echo $show0; ?>" />
label
>The start data</
"show1"
value="<?php echo $show1; ?>" />
>The end data</
"price"
value="<?php echo $price; ?>" />
>The price 1 kW/hour of electricity</
"submit"
"res"
value
"Calculate"
"clear"
" Clear "
>The sum of electricity</
if($_SERVER['REQUEST_METHOD']=='POST' && $_REQUEST['res'] && !$_REQUEST['clear']) {
echo '
Sum
', '
<b>', $E->Sum(), '</
b
>';
else {
echo null;