Warning: Undefined variable $courseObj in C:\Users\dabya\OneDrive\Documents\xamp\htdocs\projectV2\ManageCourse.php on line 26
Fatal error: Uncaught Error: Call to a member function updateCourse() on null in C:\Users\dabya\OneDrive\Documents\xamp\htdocs\projectV2\ManageCourse.php:26 Stack trace: #0 {main} thrown in C:\Users\dabya\OneDrive\Documents\xamp\htdocs\projectV2\ManageCourse.php on line 26
<?php
include 'Header.php';
$CourseObj= new Courses();
if (isset($_GET['ID']))
{
$cID = $_GET['ID'];
$CourseObj->initWithCID($cID);
}
$courseid= $CourseObj->getCourseID();
$coursename= $CourseObj->getCourseName();
if (isset($_POST['editCourse']))
{
//check if ID changed
if (isset($_POST['CID']) == $courseid)
{
$editedName = $_POST['CName'];
echo $editedName;
$CourseObj->initWithCID($courseid);
$CourseObj->setCourseID($courseid);
$CourseObj->setCourseName($editedName);
$courseObj->updateCourse();
} elseif (isset($_POST['CID']) == $courseid) {
echo "Cannot change Course ID";
}
} elseif (isset($_POST['deleteCourse']))
{
echo ("cool");
}
?>