style box1 width 190px padding 10px style div class box1 title Triangl

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<style>
.box1 {
width: 190px;
padding: 10px;
}
</style>
<div class="box1">
<a title="Triangle"><img src="http://jpegshare.net/images/d6/0d/d60dae4545f2b1764f9b4fc6ad874c4c.jpg" width="195" height="100" /> </a><br><br>
<?php
$a = $_POST['a'];
$b = $_POST['b'];
$c = $_POST['c'];
if (is_numeric($a) || is_numeric($b) || is_numeric($c))
{
if (!empty($a) && !empty($b) && empty($c))
{
$c = sqrt(pow($a,2)+pow($b,2));
$text = "C: ". $c;
}
elseif (empty($a) && empty($b) && empty($c))
{
$res="Invalid value";
}
elseif (empty($a) && !empty($b) && !empty($c))
{
$a = sqrt(pow($c,2)-pow($b,2));
$text = "A: ". $a;
}
elseif (!empty($a) && empty($b) && !empty($c))
{
$b = sqrt(pow($c,2)-pow($a,2));
$text = "B: ". $b;
}
elseif (!empty($a) && !empty($b) && !empty($c))
{
if (($a<$b+$c) && ($b<$a+$c) && ($c<$a+$b))
{
$p = ($a+$b+$c)/2;
$s = sqrt($p*($p-$a)*($p-$b)*($p-$c));
$res = "S = ". $s;
}
else
{
$res = "Invalid value";
}
}
elseif ((!empty($a) && empty($b) && empty($c)) || (empty($a) && !empty($b) && empty($c)) || (empty($a) && empty($b) && !empty($c)) )
{
$res="Invalid value";
}
}
else
{
$res="invalid value";
}
?>
<div>
<form name="calc" action="" method="post">
A:<input type="text" name="a" value="<?php echo $a; ?>"><br><br>
B:<input type="text" name="b" value="<?php echo $b; ?>"><br><br>
C:<input type="text" name="c" value="<?php echo $c; ?>"><br>
<p align="right"><input type="submit" name="submit" <value="submit"/></p>
</form> </div>
<?php
if ($_POST['submit'])
{
?>
<textarea name="" id="" cols="21" rows="1"><?php echo $res; ?></textarea>
<br><br>
<input type="button" value="Back" onclick="history.back()">
<?php
}
?>
</div>