migrated ubiquitous libraries to composer autoloader (#421)
[openemr.git] / interface / forms / CAMOS / save.php
blobb47689f7ffc07fe45b9ac8aa7334bf2331afdb6c
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("../../../library/sql.inc");
7 include_once("./content_parser.php");
9 if ($_GET["mode"] == "delete") {
10 foreach($_POST as $key => $val) {
11 if (substr($key,0,3) == 'ch_' and $val='on') {
12 $id = substr($key,3);
13 if ($_POST['delete']) {
14 sqlInsert("delete from ".mitigateSqlTableUpperCase("form_CAMOS")." where id=$id");
15 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();