Change formatting of initial comment block.
[openemr.git] / contrib / forms / example2 / save.php
blob417acb8177f62eadb98fa6e4db691f0af075c10a
1 <?php
2 /*
3 * This saves the submitted form
4 */
5 include_once("../../globals.php");
6 include_once("$srcdir/api.inc");
7 include_once("$srcdir/forms.inc");
9 /** CHANGE THIS - name of the database table associated with this form **/
10 $table_name = "form_example";
12 /** CHANGE THIS name to the name of your form **/
13 $form_name = "My Example Form";
15 /** CHANGE THIS to match the folder you created for this form **/
16 $form_folder = "example";
19 if ($encounter == "") $encounter = date("Ymd");
21 if ($_GET["mode"] == "new") {
23 /* NOTE - for customization you can replace $_POST with your own array
24 * of key=>value pairs where 'key' is the table field name and
25 * 'value' is whatever it should be set to
26 * ex) $newrecord['parent_sig'] = $_POST['sig'];
27 * $newid = formSubmit($table_name, $newrecord, $_GET["id"], $userauthorized);
30 /* save the data into the form's own table */
31 $newid = formSubmit($table_name, $_POST, $_GET["id"], $userauthorized);
33 /* link the form to the encounter in the 'forms' table */
34 addForm($encounter, $form_name, $newid, $form_folder, $pid, $userauthorized);
36 elseif ($_GET["mode"] == "update") {
37 /* update existing record */
38 $success = formUpdate($table_name, $_POST, $_GET["id"], $userauthorized);
41 $_SESSION["encounter"] = $encounter;
42 formHeader("Redirecting....");
43 formJump();
44 formFooter();