Webbserverprogrammering 1

Show sourcecode

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

webbsrvprg/exercises/ovning3/

index.html
ovn_form1.php
ovn_form2.php
ovn_form3.php
ovn_form4.php
ovn_form5.php
ovn_form6.php
ovn_form7.php
ovn_form8.php
svar.php
svar3.php
svar4.php
svar5.php
svar6.php
svar7.php
svarget.php

svar6.php

31 lines UTF-8 Windows (CRLF)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<?php
        
echo "Hej ".$_POST["name"]. " "$_POST["surname"]. " i " .$_POST["class"]. "! <br> Du gillar ";
        
$antal count($_POST["fotbollslag"]); 
        if (
$antal == 1){
            echo  
$_POST["fotbollslag"]. "! <br>";
        }
        else {
            for (
$i=0$i $antal$i++) {
                if (
$i == $antal -2){
                    echo 
$_POST["fotbollslag"][$i]. " och ";
                }
                elseif (
$i == $antal-1){
                    echo 
$_POST["fotbollslag"][$i]. "! <br>";
                }
                else{
                    echo 
$_POST["fotbollslag"][$i]. ", ";
                }
            }
        }
        echo 
"Ditt favoritäme är "$_POST["amne"];
    
?>
</body>
</html>