<?php
if(isset($_POST['a']) && isset($_POST['b']))
$result = $_POST['a'] + $_POST['b'];
else
$result = "";
$button = $_POST['operation'];
if ($_POST['submit']);
{
if ($button=='+'){$c = $a + $b; echo "сумма=" . $c.'<br>';}
if ($button =='-') {$d = $a - $b; echo "разность" . $d. '<br>';}
if ($button =='*') {$e = $a * $b; echo "произведение" . $e. '<br>';}
if ($button =='/') {$f = $a / $b; echo "частное" . $f. '<br>';}
}
?>
<html>
<head>
<title>Галерея изображений</title>
</head>
<body>
<form method="post">
<input type="text" name="a" />
<input type="button" name="operation" value='+'>+<br>
<input type = "button" name ="operation" value='-'>-<br>
<input type="button" name="operation" value='/'>/<br>
<input type="button" name="operation" value='*'>*<br>
<input type="text" name="b" />
<input type="submit" name="button" value="=" />
<?php echo $result; ?>
</form>
</body>
</html>
<input type="button" name="operation" value='+'>+<br>
<input type = "button" name ="operation" value='-'>-<br>
<input type="button" name="operation" value='/'>/<br>
<input type="button" name="operation" value='*'>*<br>
<select name="operation">
<option selected value="+">+</option>
<option value="-">-</option>
<option value="/">/</option>
<option value="*">*</option>
</select>