fix: Update patient_tracker.php (#6595)
[openemr.git] / interface / forms / phq9 / save.php
blob982ec234c6986c307234b789840aa14025beb982
1 <?php
3 /**
4 * PHQ-9 save.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Ruth Moulton <moulton ruth@muswell.me.uk>
9 * @copyright Copyright (c) 2021 ruth moulton <ruth@muswell.me.uk>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../../globals.php");
15 require_once("$srcdir/api.inc.php");
16 require_once("$srcdir/forms.inc.php");
18 use OpenEMR\Common\Csrf\CsrfUtils;
20 if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
21 CsrfUtils::csrfNotVerified();
24 if ($encounter == "") {
25 $encounter = date("Ymd");
28 if ($_GET["mode"] == "new") {
29 $newid = formSubmit("form_phq9", $_POST, $_GET["id"], $userauthorized);
30 addForm($encounter, "PHQ-9 Form", $newid, "phq9", $pid, $userauthorized);
31 } elseif ($_GET["mode"] == "update") {
32 sqlStatement(
33 "update form_phq9 set pid = ?,
34 groupname = ?,
35 user = ?,
36 authorized = ?,
37 activity = 1,
38 interest_score=?,
39 hopeless_score=?,
40 sleep_score=?,
41 fatigue_score=?,
42 appetite_score=?,
43 failure_score=?,
44 focus_score=?,
45 psychomotor_score=?,
46 suicide_score=?,
47 difficulty=?
48 where id=? ",
50 $_SESSION["pid"],
51 $_SESSION["authProvider"],
52 $_SESSION["authUser"],
53 $userauthorized,
54 $_POST["interest_score"],
55 $_POST["hopeless_score"],
56 $_POST["sleep_score"],
57 $_POST["fatigue_score"],
58 $_POST["appetite_score"],
59 $_POST["failure_score"],
60 $_POST["focus_score"],
61 $_POST["psychomotor_score"],
62 $_POST["suicide_score"],
63 $_POST["difficulty"],
64 $_GET["id"]
69 formHeader("Redirecting....");
70 formJump();
71 formFooter();