1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<?php require_once(__DIR__ . '/../checkuser.php'); if (isPost() && isset($_POST['contract_id'], $_POST['status'])) { extract($_POST); $sql = "UPDATE sup_contract set status = '".(int)$_POST['status']."' WHERE contract_id = ?"; $parameters = array((int)$_POST['contract_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"); }
$statusOptions = Contract::statusOptions(); $data = array( 'id' => $_POST['contract_id'], 'message' => 'Changed status to ' . $statusOptions[$_POST['status']] . '.', ); redirectAndExit('modifyform.php?'.http_build_query($data)); } ?>
|