Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/ovningar/formular/

index.php
ovn_fm1.php
ovn_fm2.php
ovn_fm3.php
ovn_fm4+5.php
tillagg3.php
tillagg4.php

tillagg4.php

41 lines UTF-8 Windows (CRLF)
<?php
error_reporting
(-1); // Report all type of errors
ini_set('display_errors'1); // Display all errors
ini_set('output_buffering'0); // Do not buffer outputs, write directly
?>

<!DOCTYPE html>
<html lang="sv">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Formulär</title>
</head>

<body>

    <?php
    
if (isset($_POST["fnamn"])) {
        
$output "";
        
$fnamn htmlspecialchars($_POST["fnamn"]);
        
$enamn htmlspecialchars($_POST["enamn"]);
        
$skola htmlspecialchars($_POST["skola"]);
        
$mail $_POST["mail"];
        
$mat $_POST["mat"];
        
$output $output "Hej $fnamn $enamn i $skola du gillar maten";
        for (
$i 0$i count($mat); $i++){
            
$output $output htmlspecialchars(" " $mat[$i]);
        }
        
$output $output ".";

        
$fav htmlspecialchars($_POST["fav"]);
        
$output $output " Ditt favoritämne är $fav.";
        
mail($mail"matosånt"$output);
        echo(
$output);
    }
    
?>

</body>

</html>