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

<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
$stmt=$conn->prepare("INSERT INTO prescriptions(patient_id,doctor_id,medication,dosage,instructions) VALUES (?,?,?,?,?)");
$stmt->bind_param("iisss",
$_POST['patient_id'],
$_POST['doctor_id'],
$_POST['medication'],
$_POST['dosage'],
$_POST['instructions']
);
$stmt->execute();
echo "Prescription Added";
}
?>

<div class="card">
<h2>Add Prescription</h2>

<form method="POST">
<input name="patient_id" placeholder="Patient ID">
<input name="doctor_id" placeholder="Doctor ID">
<textarea name="medication" placeholder="Medication"></textarea>
<input name="dosage" placeholder="Dosage">
<textarea name="instructions" placeholder="Instructions"></textarea>
<button>Add</button>
</form>
</div>

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