Show sourcecode
The following files exists in this folder. Click to view.
formular.php
57 lines UTF-8 Windows (CRLF)
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
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<title>formsnåntingphp</title>
</head>
<body>
<h2>Formulärerrrr</h2>
<form action="" method="POST">
<label for="first_name">Förnamn:</label><br>
<input type="text" id="first_name" name="first_name" required><br><br>
<label for="last_name">Efternamn:</label><br>
<input type="text" id="last_name" name="last_name" required><br><br>
<label for="email">Mail:</label><br>
<input type="email" id="email" name="email" required><br><br>
<input type="submit" value="Skicka">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$first_name = htmlspecialchars($_POST['first_name']);
$last_name = htmlspecialchars($_POST['last_name']);
$email = htmlspecialchars($_POST['email']);
$correct_first_name = mb_convert_case($first_name, MB_CASE_TITLE, "UTF-8");
$correct_last_name = mb_convert_case($last_name, MB_CASE_TITLE, "UTF-8");
if ($first_name === $correct_first_name && $last_name === $correct_last_name && $email ) {
echo "Inlämnad_data:"."<br>";
echo "Förnamn: " . $first_name . "<br>";
echo "Efternamn: " . $last_name . "<br>";
echo "Mail: " . $email . "<br>";
}else{
echo "storbokstav i namn dumbass";
}
}
?>
</body>
</html>