Your IP : 216.73.216.40


Current Path : /var/www/html/venkat/aviral/aviral/
Upload File :
Current File : //var/www/html/venkat/aviral/aviral/choice.php

<?php
include('fetchdropped.php');
check_auth_ldap();
?>
<html>
    <head>
        <title>Choose courses</title>
        <link rel="stylesheet" href="styles.css">
    </head>
    <body>
        <script src="js/jquery-3.4.1.min.js"></script>
        <script src="js/scripts.js"></script>

        <p> User: <?php echo $_SESSION['username'] . '<br><br>' ?></p>
        <div class="container">
        <form action='storeselection.php' method='POST'>
            <h4>Dropped Courses: </h4>
            <?php
            $dropped = fetchdropped();
            $i = 0;
            foreach($dropped as $value) {
                ?>
                <br>
                <input type="checkbox" name="choice[]" id="choice" value="<?php echo $value; ?>">
                <?php
                $coursecredits = credits($value);
                echo $value . ', ' . $coursecredits . ' credits<br>'; 
                ?>
                <?php
            }
            ?>
            <button id="add" type="submit">Add</button>
        </form>
        </div>

        <div class="container">
        <form action="removeselection.php" method="POST">
        <h4>Selected courses for summer semester: </h4>
            <?php
            $db = connectdb();
            $username = $_SESSION['username'];
            $query = <<<EOF
select course_name from courses where course_id in (select course_id from summer2019 where user_id=(select user_id from students where username='$username'));
EOF;

            $res = pg_query($db, $query);
            while($x = pg_fetch_row($res)[0]) {
                $creds = credits($x);
                echo '<input type="checkbox" name="del[]" id="del" value=' . $x . '>' . $x . ', ' . $creds . ' credits<br>';
            }
            ?>
            <button id="remove" type="submit">Remove</button>
        </form>
        </div>
    </body>
</html>