HTML5
Этот тег определяет заголовок для элемента <fieldset></fieldset>.
<?
php
class Account {
private $val0;
private $val1;
private $sign;
function __construct($arg0, $arg1, $arg2) {
$this->val0 = $arg0;
$this->val1 = $arg1;
$this->sign = $arg2;
}
function Res() {
switch($this->sign) {
case '' :
return null;
break;
case '+' :
return $this->val0 + $this->val1;
case '-' :
return $this->val0 - $this->val1;
case '*' :
return $this->val0 * $this->val1;
case '/' :
if($this->val1 == 0) {
return 'You can not divide by zero!';
else {
return $this->val0 / $this->val1;
case '%' :
return $this->val0 % $this->val1;
?>
<!DOCTYPE html>
<
html
>
head
meta
charset
=
"utf-8"
/>
title
>New Page</
</
body
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$val0 = (float)$_POST['val0'];
$val1 = (float)$_POST['val1'];
$sign = $_POST['sign'];
$
A
new
Account($val0, $val1, $sign);
$res = $A->Res();
if($_REQUEST['clear']) {
$val0 = null;
$sign = null;
$val1 = null;
$res = null;
form
action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
fieldset
legend
>The calculator</
input
type
"text"
name
"val0"
value="<?php echo $val0; ?>" />
select
"sign"
option
value
""
><?
echo $sign; ?></
"+"
>+</
"-"
>-</
"*"
>*</
"/"
>/</
"%"
>%</
"val1"
value="<?php echo $val1; ?>" />
"submit"
"perform"
"="
"res"
value="<?php echo $res; ?>" />
"clear"
"Clear"
>The result</
if($_SERVER['REQUEST_METHOD']=='POST' && $_REQUEST['perform'] && !$_REQUEST['clear']) {
echo $val0, ' ', $sign, ' ', $val1, ' = ', $res;
echo null;