33828-dev/add_student.php
Flatlogic Bot 5926dbfc54 main part
2025-09-02 19:37:21 +00:00

19 lines
439 B
PHP

<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$students_json = file_get_contents('data/students.json');
$students = json_decode($students_json, true);
$new_student = [
'name' => $_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;
}
?>