Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.2 kB
1
Indexable
Never
<?php

    // WRITE YOUR CODE HERE
    $modules = ["bpas" => "Business Process Analysis and Solutioning",
                "idp" => "Interaction Design & Prototyping",
                "wad2" => "Web Application Design II",
                "ct" => "Computational Thinking",
                "stats" => "Introductory Statistics",
                "af" => "Analytics Foundation"];
    
    $mod1 = $_POST['first_mod'];
    $mod2 = $_POST['second_mod'];
    $mod3 = $_POST['third_mod'];
    $mod4 = $_POST['fourth_mod'];

    $all_mods = [$mod1, $mod2, $mod3, $mod4];
    // check num of unique mods (returns an array)
    $results = array_unique($all_mods);
    //var_dump($results);
    if (count($all_mods) != count($results)){
        echo "<h1>You have repeated modules! Please submit your form again.</h1>";

        echo "<a href='./bidding.html' /> Back to form </a>";
    }
    else{
        echo "<table border='2'>
            <th>Modules Chosen</th>";
            foreach($all_mods as $mods){
                echo "<tr><td>$modules[$mods]</td></tr>";
            }
        
        
        echo "</table>";
    }
?>