/var/www/onesupportdemo.onesolution.hk/customer/view.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
require_once(__DIR__ '/../checkuser.php');
function 
view($id) {
    global 
$dbh;
    
    
$sql "SELECT * FROM v_cm_customer_support V_CM_CUSTOMER_SUPPORT WHERE cust_id = ?";
    
$parameters = array($id);
    if (!(
$sth $dbh->prepare($sql))) {
        throw new 
Exception("sql prepare statement failure: $sql");
    }
    
$sth->setFetchMode(PDO::FETCH_ASSOC);
    if (!
$sth->execute($parameters)) {
        throw new 
Exception("sql execute statement failure: $sql");
    }
    
$customer $sth->fetch(PDO::FETCH_ASSOC);
    if (empty(
$customer)) {
        throw new 
Exception('Customer not found!');
    }
    return array(
        
'customer' => $customer,
    );
}
extract(view($_GET['id']));
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    
    <?php require(__DIR__ '/../inc/_head_meta.php'); ?>
    
    <?php require(__DIR__ '/../inc/_head_css.php'); ?>
    
    <style type="text/css">
        body {
            padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
            padding-bottom: 40px;
        }
    </style>
    
    <?php require(__DIR__ '/../inc/_head_script.php'); ?>
    
</head>
<body>
    
    <?php require(__DIR__ '/../inc/_navbar.php'); ?>
    
    <div class="container">

        <table class="table table-striped">
            <caption class="text-left"><h2>Teacher Detail</h2></caption>
            <tbody>
                <tr>
                    <td>Number:</td>
                    <td><?=h($customer['cust_id'])?></td>
                </tr>
                <tr>
                    <td>Name:</td>
                    <td><?=h($customer['company_name'])?></td>
                </tr>
                <tr>
                    <td>Address:</td>
                    <td><address><?=h($customer['billaddress'])?></address></td>
                </tr>
                <tr class="hidden">
                    <td>Contact Person:</td>
                    <td><?=h($customer['contact_person'])?></td>
                </tr>
                <tr>
                    <td>Tel no.:</td>
                    <td><?=h($customer['tel_no'])?></td>
                </tr>
                <tr>
                    <td>E-mail:</td>
                    <td><?=h($customer['email'])?></td>
                </tr>
                <tr class="hidden">
                    <td>Support E-mail:</td>
                    <td><?=h($customer['email_support'])?></td>
                </tr>
                <tr>
                    <td>Status:</td>
                    <td><?=$customer['enable'] == 'Enable' 'Disable'?></td>
                </tr>
            </tbody>
        </table>
        
        <div class="control-group">
            <div class="controls">
                <button type="button" class="btn btn-default" onClick="history.go(-1);">Back</button>
            </div>
        </div>        
    
        <?php require(__DIR__ '/../inc/_footer.php'); ?>

    </div> <!-- /container -->
</body>
</html>