Documente Academic
Documente Profesional
Documente Cultură
HTML
HTML
<head>
<title>Colocviu</title>
</head>
<body>
<h3>Introduceti latura</h3>
<form method="POST" action="colocviu1.php">
Latura: <BR>
<input type="text" size=15 maxlength=15 name="l">
<BR><BR>
<input type="radio" name="option" value="perimetru"> Perimetrul triunghiului
echilateral este
<input type="radio" name="option" value="arie"> Aria triunghiului echilatera
l este
<button type="submit">Trimite</button>
</form>
</body>
</html>
<?php
$latura = $_POST['l'];
$option = $_POST['option'];
if ($_POST['option'] === 'perimetru') {
$perimetru = 3 * $latura;
echo "Perimetru triunghiului este $perimetru";
}
if ($_POST['option'] === 'arie') {
$arie = ($latura * $latura *sqrt(3))/4;
echo "Aria triunghiului este $arie";
}
?>