Show sourcecode
The following files exists in this folder. Click to view.
cookies.php
formular.php
fragetest3.php
funktioner.php
grunder.php
include/
klasser.php
ovn_cookies1.php
ovn_cookies2.php
ovn_form1.php
ovn_form2.php
ovn_form3.php
ovn_form4.php
ovn_form6.php
ovn_funk1.php
ovn_funk2.php
ovn_funk3.php
ovn_funk4.php
ovn_funk5.php
ovn_grn1.php
ovn_grn2.php
ovn_grn3a.php
ovn_grn3b.php
ovn_include1.php
ovn_klasser1.php
ovn_string1.php
ovn_string2.php
ovn_string3.php
ovn_stringsvar1.php
ovn_stringsvar2.php
ovn_stringsvar3.php
sida1.php
string.php
ovn_form6.php
44 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$frnamn = $_POST["frnamn"];
$efternamn = $_POST["efternamn"];
$klass = $_POST["klass"];
$mat = isset($_POST["mat"]) ? $_POST["mat"] : [];
$kurs = $_POST["kurs"];
echo "Hej $frnamn $efternamn i $klass<br>";
echo "Din favoritkurs är $kurs<br>";
if (count($mat) > 1) {
echo "Dina favoriträtter är: " . implode(", ", $mat) . "<br>";
} else {
echo "Din favoriträtt är: " . (isset($mat[0]) ? $mat[0] : "ingen") . "<br>";
}
}
?>
<form method="post" action="">
Förnamn: <input type="text" name="frnamn">
Efternamn: <input type="text" name="efternamn">
Klass: <input type="text" name="klass"><br><br>
<input type="checkbox" name="mat[]" value="Subway footlong"><label for="Subway Footlong">Subway footlong</label><br>
<input type="checkbox" name="mat[]" value="Bamses pizza"><label for="Bamses pizza">Bamses pizza</label><br>
<input type="checkbox" name="mat[]" value="Choklad"><label for="Choklad">Choklad</label><br>
<input type="checkbox" name="mat[]" value="Kebab"><label for="Kebab">Kebab</label><br>
<input type="checkbox" name="mat[]" value="Sand"><label for="Sand">Sand</label><br>
<input type="checkbox" name="mat[]" value="Hundmat"><label for="Hundmat">Hundmat</label><br>
<input type="checkbox" name="mat[]" value="Råttgift"><label for="Råttgift">Råttgift</label><br>
<br><br>
<input type="radio" name="kurs" value="Kemi"><label for="Kemi">Kemi</label><br>
<input type="radio" name="kurs" value="Religion"><label for="Religion">Religion</label> <br>
<input type="radio" name="kurs" value="Webbserverprogrammering"><label for="Webbserverprogrammering">Webbserverprogrammering</label><br><br>
<input type="submit" value="Skicka">
</form>
</body>
</html>