diff --git a/add_course.php b/add_course.php new file mode 100644 index 0000000..a7dd67f --- /dev/null +++ b/add_course.php @@ -0,0 +1,19 @@ + $_POST['name'], + 'description' => $_POST['description'], + 'instructor' => $_POST['instructor'], + ]; + + $courses[] = $new_course; + + file_put_contents('data/courses.json', json_encode($courses, JSON_PRETTY_PRINT)); + + header('Location: courses.php'); + exit; +} +?> diff --git a/add_instructor.php b/add_instructor.php new file mode 100644 index 0000000..7c60d3d --- /dev/null +++ b/add_instructor.php @@ -0,0 +1,18 @@ + $_POST['name'], + 'email' => $_POST['email'], + ]; + + $instructors[] = $new_instructor; + + file_put_contents('data/instructors.json', json_encode($instructors, JSON_PRETTY_PRINT)); + + header('Location: instructors.php'); + exit; +} +?> diff --git a/add_student.php b/add_student.php new file mode 100644 index 0000000..82d76d5 --- /dev/null +++ b/add_student.php @@ -0,0 +1,18 @@ + $_POST['name'], + 'email' => $_POST['email'], + ]; + + $students[] = $new_student; + + file_put_contents('data/students.json', json_encode($students, JSON_PRETTY_PRINT)); + + header('Location: students.php'); + exit; +} +?> diff --git a/courses.php b/courses.php new file mode 100644 index 0000000..674dc05 --- /dev/null +++ b/courses.php @@ -0,0 +1,82 @@ + + +
= htmlspecialchars($course['description']) ?>
+Instructor: = htmlspecialchars($course['instructor'] ?? 'N/A') ?>
+No courses found. Click 'Add New Course' to get started!
+