<?php include "layout.php"; ?>

<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$stmt = $conn->prepare("INSERT INTO lab_results(patient_id, doctor_id, test_name, test_result, test_date, lab_name) VALUES (?,?,?,?,?,?)");
$stmt->bind_param("iissss",
    $_POST['patient_id'],
    $_POST['doctor_id'],
    $_POST['test_name'],
    $_POST['test_result'],
    $_POST['test_date'],
    $_POST['lab_name']
);
$stmt->execute();
echo "Lab Result Added";
}
?>

<div class="card">
<h2>Add Lab Result</h2>

<form method="POST">
<input name="patient_id" placeholder="Patient ID" required>
<input name="doctor_id" placeholder="Doctor ID" required>
<input name="test_name" placeholder="Test Name">
<textarea name="test_result" placeholder="Test Result"></textarea>
<input type="date" name="test_date">
<input name="lab_name" placeholder="Lab Name">
<button>Add</button>
</form>
</div>

</div>
</body>
</html>