title Triangle img src http jpegshare net images d6 0d d60dae4545f2b17

 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
<a title="Triangle"><img src="http://jpegshare.net/images/d6/0d/d60dae4545f2b1764f9b4fc6ad874c4c.jpg" width="195" height="100" /> </a><br>
<?php
$a = $_POST['a'];
$b = $_POST['b'];
$c = $_POST['c'];
if (!empty($_POST['a']) && !empty($_POST['b']) && empty($_POST['c']))
{
$c = sqrt(pow($a,2)+pow($b,2));
$text = "C: ". $c;
}
elseif (empty($_POST['a']) && !empty($_POST['b']) && !empty($_POST['c']))
{
$a = sqrt(pow($c,2)-pow($b,2));
$text = "A: ". $a;
}
elseif (!empty($_POST['a']) && empty($_POST['b']) && !empty($_POST['c']))
{
$b = sqrt(pow($c,2)-pow($a,2));
$text = "B: ". $b;
}
elseif (!empty($_POST['a']) && !empty($_POST['b']) && !empty($_POST['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";
}
}
?>
<form name="bla" 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><br>
<input type="submit" name="submit" <value="submit"/>
</form>
<?php
if ($_POST['submit'])
{
?>
<textarea name="" id="" cols="21" rows="1"><?php echo $res; ?></textarea>
<br>
<a href="/">Back</a>
<?php
}
?>