-
-
Save anonymous/58a5dbea90dd9e3b1d43432ffa0cd0d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '../manager-session.php'; | |
require '../../db-config.php'; | |
require '../../distributor-config.php'; | |
// var_dump($_POST['course']) | |
if(isset($_POST['course'])) { | |
foreach($_POST['course'] as $course) { | |
$selected = explode('-', $_POST['course']); | |
$coursetitle = $selected[0]; | |
$username = $selected[1]; | |
$stmt = $conn->prepare("INSERT INTO users_on_courses (useroncourse, course) VALUES (?, ?)"); | |
$stmt->bind_param("ss", $username, $coursetitle); | |
$stmt->execute(); | |
} | |
header('location: ../add-users-to-courses.php?page=add-users-to-courses&status=success'); | |
exit(); | |
} | |
else { | |
header('location: ../add-users-to-courses.php?page=add-users-to-courses&status=error'); | |
exit(); | |
} | |
$stmt->close(); | |
$conn->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment