Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/exercises/textsträngar/
textsträng1.php
textsträng2.php
textsträng3.php
textsträng4.php
textsträng5.php
textsträng6.php
textsträng3.php
44 lines UTF-8 Windows (CRLF)
<?php
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('output_buffering', 0);
?>
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="utf-8" />
<title>Textsträng 3</title>
</head>
<body>
<?php
if (!isset($_POST["tal1"]) && !isset($_POST["tal2"])) {
?>
<h1>Textsträng 3</h1>
<form method="post" action="">
<table>
<tr>
<td>Första tal</td>
<td><input type="text" name="tal1"></td>
</tr>
<tr>
<td>Andra tal</td>
<td><input type="text" name="tal2"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Skicka"></td>
</tr>
</table>
</form>
<?php
}
if (isset($_POST["tal1"]) && isset($_POST["tal2"])) {
$tal1 = $_POST["tal1"];
$tal2 = $_POST["tal2"];
echo($tal1."<br>".$tal2."<br>");
echo round($tal1/$tal2, 2);
}
?>
</body>
</html>