I was under the impression that since JavaScript is client-side and PHP is server-side, that it is impossible to call PHP from JavaScript; however, this code snippet works:
<script>
function otherCourse(){
var course = prompt("prompt?");
document.write("
<?php
$con->query("INSERT INTO `Courses` (`Name`) VALUES ('blah')");
?>
");
}
</script>
Why does this work? The entry was inserted into the database