Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogramering/exercises/
phpstartsida.php
uppgiftForm_1.php
uppgiftFunk_1.php
uppgiftFunk_2.php
uppgiftFunk_3.php
uppgiftFunk_4.php
uppgiftFunk_5.php
uppgiftFunk_6.php
uppgiftIncl_1.php
uppgiftIncl_1_incl.php
uppgiftIncl_2_1.php
uppgiftIncl_2_2.php
uppgiftIncl_2_3.php
uppgiftIncl_2_slut.php
uppgiftIncl_2_start.php
uppgiftIncl_2_tal.php
uppgiftQuiz.php
uppgiftString_1.php
uppgiftString_2.php
uppgiftString_3.php
uppgiftString_4.php
uppgiftString_5.php
uppgift_1.php
uppgift_2.php
uppgift_3.php
uppgift_4.php
uppgift_5.php
uppgiftString_4.php
75 lines UTF-8 Windows (CRLF)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="" method="post">
<input type="text" name="fNamn" placeholder="Förnamn">
<br><br>
<input type="text" name="eNamn" placeholder="Efternamn">
<br><br>
<input type="text" name="epost" placeholder="Mailadres">
<br><br>
<button type="submit" name="sent" value="1">Skicka</button>
</form>
<?php
if (isset($_POST["sent"])) {
if ($_POST["fNamn"]!="") {
echo mb_convert_case($_POST["fNamn"], MB_CASE_TITLE_SIMPLE). " ";
}
else {
echo "<br> Fyll i Förnamn";
}
if ($_POST["eNamn"]!="") {
echo mb_convert_case($_POST["eNamn"], MB_CASE_TITLE_SIMPLE);
}
else {
echo "<br> Fyll i all Efternamn";
}
if ($_POST["epost"]!="") {
if (str_contains($_POST["epost"],"@") && str_contains($_POST["epost"],".")) {
$len = mb_strlen($_POST["epost"]);
$efAt = mb_strpos($_POST["epost"], "@");
$pp = mb_strpos($_POST["epost"], ".");
if ($len > 6) {
} else {
echo "<br> Emailadresen måste vara åtminstånde 6 tecken lång";
}
if ($len - $efAt >= 4) {
} else {
echo "<br> Det måste vara åtminstånde 4 tecken efter @:et";
}
if ($len - $pp > 2 && $pp > $efAt) {
} else {
echo "<br> Emailadresen måste innehålla en . mellan @:et och de sista två tecknerna i emailadresen";
}
} else {
echo "<br> Emailadresen måste inehålla ett @ och en .";
}
} else {
echo "<br> Fyll i all Epost";
}
}
?>
</body>
</html>