//разделяем строк на 2 переменые с помощью разделителя - получаем id которое передали и ммя $member_id = $member_info[0]; $f_member = $member_info[1]; $Check_job = new Check_job(); //create an object of class $res = $Check_job->check($job_id); //We check if we give this job to a family member if ($res === TRUE) { //We check if we give this job to a family member $_SESSION['info'] = 'Work is already taken'; header("Location: ../main.php"); } else { if ($member_id == 1) { //keep the job mother //$Add_job = new Family_mother(); //create ogject of registr_user class $query = Family_mother::insert($job_id, $member_id, $job_title); //call the method to check user data in MySQL Table Family_job::Update($job_id, $f_member); //call the method to save in DB the name of the employee if ($query === TRUE) { $_SESSION['info'] = 'New job add'; header("Location: ../main.php"); } else { $_SESSION['info'] = 'Error'; header("Location: ../main.php"); } } if ($member_id == 2) { //keep the job father //$Add_job = new Family_father(); //create ogject of registr_user class $query = Family_father::insert($job_id, $member_id, $job_title);
$job_title = $_POST['job_title']; $f_member = $_POST['family']; $Check_job = new Check_job(); //create an object of class $res = $Check_job->check($job_id); //We check if we give this job to a family member if ($res === TRUE) { //We check if we give this job to a family member $_SESSION['info'] = 'Work is already taken'; header("Location: ../main.php"); } else { if ($f_member == 'mother') { //keep the job mother $Add_job = new Family_mother(); //create ogject of registr_user class $query = $Add_job->insert($job_id, $job_title); //call the method to check user data in MySQL Table $Job_performs = new Family_job(); //create an object of class Family_job $Job_performs->Update($job_id, $f_member); //call the method to save in DB the name of the employee if ($query === TRUE) { $_SESSION['info'] = 'New job add'; header("Location: ../main.php"); } else { $_SESSION['info'] = 'Error'; header("Location: ../main.php"); } } if ($f_member == 'father') { //keep the job father