Highway to PSR2
[openemr.git] / interface / forms / CAMOS / save.php
blobc810ac12360970b7db4d089ffec489b377ac7ee1
1 <?php
2 //------------This file inserts your field data into the MySQL database
3 include_once("../../globals.php");
4 include_once("../../../library/api.inc");
5 include_once("../../../library/forms.inc");
6 include_once("./content_parser.php");
8 if ($_GET["mode"] == "delete") {
9 foreach ($_POST as $key => $val) {
10 if (substr($key, 0, 3) == 'ch_' and $val='on') {
11 $id = substr($key, 3);
12 if ($_POST['delete']) {
13 sqlInsert("delete from ".mitigateSqlTableUpperCase("form_CAMOS")." where id=$id");
14 sqlInsert("delete from forms where form_name like 'CAMOS%' and form_id=$id");
17 if ($_POST['update']) {
18 // Replace the placeholders before saving the form. This was changed in version 4.0. Previous to this, placeholders
19 // were submitted into the database and converted when viewing. All new notes will now have placeholders converted
20 // before being submitted to the database. Will also continue to support placeholder conversion on report
21 // views to support notes within database that still contain placeholders (ie. notes that were created previous to
22 // version 4.0).
23 $content = strip_escape_custom($_POST['textarea_'.${id}]);
24 $content = add_escape_custom(replace($pid, $encounter, $content));
25 sqlInsert("update ".mitigateSqlTableUpperCase("form_CAMOS")." set content='$content' where id=$id");
31 $_SESSION["encounter"] = $encounter;
32 formHeader("Redirecting....");
33 formJump();
34 formFooter();