Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbsrvprg/exercises/lekt5/

formular.php

formular.php

57 lines UTF-8 Windows (CRLF)
<!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_nameMB_CASE_TITLE"UTF-8");
        
$correct_last_name mb_convert_case($last_nameMB_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>