/var/www/(Del)pathways.org.hk/MIS20140127/old20140414/System/Subject.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

<!DOCTYPE html>
<html>
    <head>
        <?php require_once '../include/head.php'?>
        <?php require_once '../include/checkuser.php'?>
        <?php require_once '../include/Nav_bar.php'?>
        <?php include_once '../include/DBConnect.php'?>
    </head>
    <body>
        <?php
        
if (isset($_POST['sub_se'])) {
            
$del_id $_POST['sub_se'];
            
$sth $dbh->prepare("UPDATE `subject` SET `lastupby`= 1,`lastupdate`= now(), `deleted`= 1 WHERE subject_id = '$del_id'");
            
$sth->execute();

            echo 
"<script>alert('delete data successful.')</script>";
            echo(
"<script>location.href ='Subject.php';</script>");
        }
        
?>
        <!-- line between nav bar and content -->
        <div class="text-right">
            <ul class="breadcrumb">
                <li class="active">Subject</li>
            </ul>
        </div>

        <div class="container-fluid pathways-container">
            <div>
                <table border="0" width="100%">
                    <tr>
                        <td><h2>Subject</h2></td>
                        <td><a href="addSubject.php" class="btn pull-right"><i class="icon-plus"></i> Add</a></td>
                    </tr>
                </table>
            </div>
            <form id="search_form" class="form-inline" action="" method="POST">
            <table class="table table-striped table-bordered table-hover table-condensed" id="tablehead">  
                <thead>
                    <tr>
                        <th style="min-width:20px; width:5%">&nbsp;</th>
                        <th style="min-width:50px; width:5%">Edit</th>
                        <th style="min-width:50px; width:30%">Subject_Code</th>
                        <th style="min-width:150px; width:40%">Subject_Name</th>
                        <th style="min-width:50px;">Subject_ShortFrom</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $query 
"select subject_id, sub_code, sub_name, sub_short_form from subject where deleted = 0";
                    
$result $dbh->query($query);
                    
$result->setFetchMode(PDO::FETCH_OBJ);
                    while (
$row $result->fetch()) {
                        
?>
                        <tr>
                            <td>
                                <button class="btn" name="sub_se" value="<?= $row->subject_id ?>" type="submit"><i class="icon-remove"></i></button>
                            </td>
                            <td>
                                <a href="editSubject.php?id=<?= $row->subject_id ?>" class="btn">Edit</a>
                            </td>
                            <td>
                                <?= $row->sub_code ?>
                            </td>
                            <td>
                                <?= $row->sub_name ?>
                            </td>
                            <td>
                                <?= $row->sub_short_form ?>
                            </td>   
                        </tr>
                        <?php
                    
}
                    
?>
                </tbody>
            </table>
            </form>
        </div> <!-- /container -->
    </body>
</html>