Planning Assessment

Plan

Assess

“`php PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC ] ); } catch (PDOException $e) { die( “Database connection failed.” ); } // ====================================================== // PROCESS FORM // ====================================================== if ($_SERVER[“REQUEST_METHOD”] === “POST”) { // ================================================== // CLIENT DETAILS // ================================================== $firstName = trim($_POST[“first_name”] ?? “”); $lastName = trim($_POST[“last_name”] ?? “”); $nomenclature = trim($_POST[“nomenclature”] ?? “”); $dateOfBirth = $_POST[“date_of_birth”] ?? “”; // ================================================== // CARE INFORMATION // ================================================== $carePlan = trim($_POST[“care_plan”] ?? “”); $personalNeeds = trim( $_POST[“personal_needs”] ?? “” ); $relaxationTechnique = trim( $_POST[“relaxation_technique”] ?? “” ); // ================================================== // DAYS // ================================================== $monday = isset($_POST[“monday”]) ? 1 : 0; $tuesday = isset($_POST[“tuesday”]) ? 1 : 0; $wednesday = isset($_POST[“wednesday”]) ? 1 : 0; $thursday = isset($_POST[“thursday”]) ? 1 : 0; $friday = isset($_POST[“friday”]) ? 1 : 0; $saturday = isset($_POST[“saturday”]) ? 1 : 0; $sunday = isset($_POST[“sunday”]) ? 1 : 0; // ================================================== // CARE TIME SLOTS // ================================================== $morning20 = isset($_POST[“morning_20”]) ? 1 : 0; $lunchtime30 = isset($_POST[“lunchtime_30”]) ? 1 : 0; $evening25 = isset($_POST[“evening_25”]) ? 1 : 0; // ================================================== // VALIDATION // ================================================== if ($firstName === “” || $lastName === “”) { $message = “Please enter the client’s first and last name.”; $messageType = “error”; } else { try { // ================================================== // INSERT CLIENT // ================================================== $sql = ” INSERT INTO client ( first_name, last_name, nomenclature, date_of_birth, care_plan, personal_needs, relaxation_technique, monday, tuesday, wednesday, thursday, friday, saturday, sunday, morning_20, lunchtime_30, evening_25 ) VALUES ( :first_name, :last_name, :nomenclature, :date_of_birth, :care_plan, :personal_needs, :relaxation_technique, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday, :morning_20, :lunchtime_30, :evening_25 ) “; $stmt = $pdo->prepare($sql); $stmt->execute([ “:first_name” => $firstName, “:last_name” => $lastName, “:nomenclature” => $nomenclature, “:date_of_birth” => $dateOfBirth ?: null, “:care_plan” => $carePlan, “:personal_needs” => $personalNeeds, “:relaxation_technique” => $relaxationTechnique, “:monday” => $monday, “:tuesday” => $tuesday, “:wednesday” => $wednesday, “:thursday” => $thursday, “:friday” => $friday, “:saturday” => $saturday, “:sunday” => $sunday, “:morning_20” => $morning20, “:lunchtime_30” => $lunchtime30, “:evening_25” => $evening25 ]); // ================================================== // SUCCESS // ================================================== $message = “Care plan saved successfully.”; $messageType = “success”; // Clear form values after successful save $firstName = “”; $lastName = “”; $nomenclature = “”; $dateOfBirth = “”; $carePlan = “”; $personalNeeds = “”; $relaxationTechnique = “”; } catch (PDOException $e) { $message = “The care plan could not be saved.”; $messageType = “error”; } } } ?> Client Care Plan

Client Care Plan

Identity

” required > ” required > ” > ” >

Care Plan

Relaxation Technique

Enter the relaxation technique or instructions appropriate for this individual client.

Days

Care Time Slots

“`