diff --git a/add_student.php b/add_student.php new file mode 100644 index 0000000..c3c1294 --- /dev/null +++ b/add_student.php @@ -0,0 +1,147 @@ +exec("CREATE TABLE IF NOT EXISTS students ( + id INT AUTO_INCREMENT PRIMARY KEY, + first_name VARCHAR(100) NOT NULL, + last_name VARCHAR(100) NOT NULL, + date_of_birth DATE NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + );"); + + if ($_SERVER["REQUEST_METHOD"] == "POST") { + $first_name = trim($_POST['first_name']); + $last_name = trim($_POST['last_name']); + $date_of_birth = trim($_POST['date_of_birth']); + + if (empty($first_name) || empty($last_name) || empty($date_of_birth)) { + $notification = ["type" => "danger", "message" => "All fields are required."]; + } else { + $stmt = $pdo->prepare("INSERT INTO students (first_name, last_name, date_of_birth) VALUES (?, ?, ?)"); + if ($stmt->execute([$first_name, $last_name, $date_of_birth])) { + $notification = ["type" => "success", "message" => "Student added successfully!"]; + } else { + $notification = ["type" => "danger", "message" => "Error: Could not add student."]; + } + } + } +} catch (Exception $e) { + $notification = ["type" => "danger", "message" => "Database error: " . $e->getMessage()]; + error_log("DB Error: " . $e->getMessage()); +} +?> + + +
+ + +| Username | +Role | +Actions | +
|---|---|---|
| = htmlspecialchars($user['username']) ?> | += htmlspecialchars($user['role_name']) ?> | ++ + + + | +
= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.
-This page will update automatically as the plan is implemented.
-Runtime: PHP = htmlspecialchars($phpVersion) ?> — UTC = htmlspecialchars($now) ?>
No students have been added yet. Add the first one!
+ +| # | +First Name | +Last Name | +Date Added | +Actions | +
|---|---|---|---|---|
| = htmlspecialchars($student['id']) ?> | += htmlspecialchars($student['first_name']) ?> | += htmlspecialchars($student['last_name']) ?> | += date("M d, Y", strtotime($student['created_at'])) ?> | ++ View + | +
Student Profile
+No behavior entries have been logged for this student yet.
+ +No academic records have been logged for this student yet.
+ +| Subject | +Grade | +Comments | +Date | +Actions | +
|---|---|---|---|---|
| + | + | + | + + | + + + | + +
No additional details have been logged for this student yet.
+ +| Title | +Details | +Date | +Actions | +
|---|---|---|---|
| + | + | + + | + + + | + +