File "template.php"
Full path: /home/atrmarke/public_html/atrdemolive.site/lab/pages/template.php
File
size: 0.01 KB (6.4 KB bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
include("../db/cn.php");
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['add_temp'])) {
$temp_name = $_POST["temp_name"];
$category = $_POST["category"];
$template_data = $_POST["template_data"];
// Assuming $connection is your valid database connection
$query = "INSERT INTO template_report (temp_name, category, template_data) VALUES ('".$temp_name."','".$category."','".$template_data."')";
if (mysqli_query($connection, $query)) {
// Redirect to patient.php after successful insertion
header("Location: template.php");
exit(); // Make sure to exit after the redirect to prevent further code execution
} else {
echo "Error: " . $query . "<br>" . mysqli_error($connection);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="apple-touch-icon" sizes="76x76" href="../assets/img/apple-icon.png">
<link rel="icon" type="image/png" href="../img/print_logo.png">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Laboratory L.I.M.S</title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
<link href="https://fonts.googleapis.com/css?family=Quicksand:500,700,200" rel="stylesheet" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link href="../assets/css/light-bootstrap-dashboard.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- TinyMCE -->
<script src="https://cdn.tiny.cloud/1/gh8a4bv6yabt694owzs0t7p8k6i9p335ou8u8un1k8alt58b/tinymce/7/tinymce.min.js" referrerpolicy="origin"></script>
<!-- Place the following <script> and <textarea> tags your HTML's <body> -->
<script>
tinymce.init({
selector: 'textarea',
plugins: 'anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount checklist mediaembed casechange export formatpainter pageembed linkchecker a11ychecker tinymcespellchecker permanentpen powerpaste advtable advcode editimage advtemplate ai mentions tinycomments tableofcontents footnotes mergetags autocorrect typography inlinecss markdown',
toolbar: 'undo redo | blocks fontfamily fontsize | bold italic underline strikethrough | link image media table mergetags | addcomment showcomments | spellcheckdialog a11ycheck typography | align lineheight | checklist numlist bullist indent outdent | emoticons charmap | removeformat',
tinycomments_mode: 'embedded',
tinycomments_author: 'Author name',
mergetags_list: [
{ value: 'First.Name', title: 'First Name' },
{ value: 'Email', title: 'Email' },
],
ai_request: (request, respondWith) => respondWith.string(() => Promise.reject("See docs to implement AI Assistant")),
});
</script>
<style>
/* Custom CSS to adjust spacing if needed */
body {
font-family: Arial, sans-serif;
}
.editor-container {
margin: 20px auto;
max-width: 800px;
}
</style>
</head>
<?php
$rec_category = mysqli_query($connection,"select test_name from lab_test");
?>
<body>
<div class="wrapper">
<div class="sidebar" data-image="../assets/img/sidebar-7.jpg">
<?php include("common/sd.php"); ?>
</div>
<div class="main-panel">
<?php include("common/hd.php"); ?>
<div class="content">
<div class="container " style="padding:20px; background:#fff; border:1px solid #CCC; border-radius:10px;">
<form action="template.php" method="post" enctype="multipart/form-data">
<div class="row">
<div class="col-sm-5">
<h3>Create Report Template</h3>
<br>
<div class="form-group">
<label>Template Name</label>
<input type="text" name="temp_name" class="form-control" />
</div>
<div class="form-group">
<label>Category</label>
<select name="category" class="form-control" >
<option value="">Select</option>
<?php
while($row_category = mysqli_fetch_array($rec_category))
{
?>
<option value="<?php echo $row_category["test_name"]; ?>"><?php echo $row_category["test_name"]; ?></option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-sm-6"></div>
<div class="col-sm-1"></div>
<div>
</div>
<div class="row">
<div class="col-sm-12">
<textarea id="editor" name="template_data">
</textarea>
<br>
<button type="submit" class="btn bg-dark text-white" name="add_temp" >Save</button>
</div>
</div>
</div>
</form>
</div>
<footer class="footer">
<div class="container-fluid">
</div>
</footer>
</div>
</div>
<!-- Bootstrap JS and dependencies -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<!-- CKEditor 5 -->
<!-- Other JS dependencies -->
<script src="../assets/js/core/bootstrap.min.js" type="text/javascript"></script>
<script src="../assets/js/plugins/bootstrap-switch.js"></script>
<script src="../assets/js/plugins/chartist.min.js"></script>
<script src="../assets/js/plugins/bootstrap-notify.js"></script>
<script src="../assets/js/light-bootstrap-dashboard.js?v=2.0.0" type="text/javascript"></script>
<script src="../assets/js/demo.js"></script>
</body>
</html>