<?php
session_start();

// Check if the admin is logged in; if not, redirect to the login page
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
    header('Location: admin.php');
    exit();
}

require('config.php');

// Fetch the statistics
$sql_submissions = "SELECT COUNT(*) as submission_count FROM responses";
$result_submissions = $conn->query($sql_submissions);

if ($result_submissions === false) {
    die("Error: " . $conn->error);
}

$row_submissions = $result_submissions->fetch_assoc();

//getting results for item_1

// $sql_percentage_item1 = "SELECT 
//                           (SUM(CASE WHEN item_1 = 'course_details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
//                           (SUM(CASE WHEN item_1 = 'careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
//                           (SUM(CASE WHEN item_1 = 'student_stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3
//                         FROM responses";
// $result_percentage = $conn->query($sql_percentage_item1);
// if ($result_percentage === false) {
//     die("Error: " . $conn->error);
// }

// $row_percentage = $result_percentage->fetch_assoc();

$sql_percentage_item1 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Banner image' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_1 = $conn->query($sql_percentage_item1);
if ($result_percentage_1 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_1 = $result_percentage_1->fetch_assoc();


//getting results for item_2

$sql_percentage_item2 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Social share links' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_2 = $conn->query($sql_percentage_item2);

if ($result_percentage_2 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_2 = $result_percentage_2->fetch_assoc();


//getting results for item_3

$sql_percentage_item3 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Overview' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_3 = $conn->query($sql_percentage_item3);

if ($result_percentage_3 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_3 = $result_percentage_3->fetch_assoc();

//getting results for item_4

$sql_percentage_item4 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Apply button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_4 = $conn->query($sql_percentage_item4);

if ($result_percentage_4 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_4 = $result_percentage_4->fetch_assoc();

//getting results for item_5

$sql_percentage_item5 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'How to apply' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_5 = $conn->query($sql_percentage_item5);

if ($result_percentage_5 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_5 = $result_percentage_5->fetch_assoc();

//getting results for item_6

$sql_percentage_item6 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Contact us button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_6 = $conn->query($sql_percentage_item6);

if ($result_percentage_6 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_6 = $result_percentage_6->fetch_assoc();

//getting results for item_7

$sql_percentage_item7 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Student stories' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_7 = $conn->query($sql_percentage_item7);

if ($result_percentage_7 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_7 = $result_percentage_7->fetch_assoc();

//getting results for item_8

$sql_percentage_item8 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Course details' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_8 = $conn->query($sql_percentage_item8);

if ($result_percentage_8 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_8 = $result_percentage_8->fetch_assoc();

//getting results for item_9

$sql_percentage_item9 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Industry accreditations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_9 = $conn->query($sql_percentage_item9);

if ($result_percentage_9 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_9 = $result_percentage_9->fetch_assoc();

//getting results for item_10

$sql_percentage_item10 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Entry requirements' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_10 = $conn->query($sql_percentage_item10);

if ($result_percentage_10 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_10 = $result_percentage_10->fetch_assoc();

//getting results for item_11

$sql_percentage_item11 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Fees & funding' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_11 = $conn->query($sql_percentage_item11);

if ($result_percentage_11 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_11 = $result_percentage_11->fetch_assoc();

//getting results for item_12

$sql_percentage_item12 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Careers' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_12 = $conn->query($sql_percentage_item12);

if ($result_percentage_12 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_12 = $result_percentage_12->fetch_assoc();

//getting results for item_13

$sql_percentage_item13 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Course specific stats' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_13 = $conn->query($sql_percentage_item13);

if ($result_percentage_13 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_13 = $result_percentage_13->fetch_assoc();

//getting results for item_14

$sql_percentage_item14 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Related courses' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_14 = $conn->query($sql_percentage_item14);

if ($result_percentage_14 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_14 = $result_percentage_14->fetch_assoc();

//getting results for item_15

$sql_percentage_item15 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Testimonials' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_15 = $conn->query($sql_percentage_item15);

if ($result_percentage_15 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_15 = $result_percentage_15->fetch_assoc();

//getting results for item_16

$sql_percentage_item16 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Environmental considerations' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_16 = $conn->query($sql_percentage_item16);

if ($result_percentage_16 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_16 = $result_percentage_16->fetch_assoc();

//getting results for item_17

$sql_percentage_item17 = "SELECT 
                          (SUM(CASE WHEN item_1 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item1,
                          (SUM(CASE WHEN item_2 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item2,
                          (SUM(CASE WHEN item_3 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item3,
                          (SUM(CASE WHEN item_4 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item4,
                          (SUM(CASE WHEN item_5 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item5,
                          (SUM(CASE WHEN item_6 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item6,
                          (SUM(CASE WHEN item_7 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item7,
                          (SUM(CASE WHEN item_8 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item8,
                          (SUM(CASE WHEN item_9 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item9,
                          (SUM(CASE WHEN item_10 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item10,
                          (SUM(CASE WHEN item_11 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item11,
                          (SUM(CASE WHEN item_12 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item12,
                          (SUM(CASE WHEN item_13 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item13,
                          (SUM(CASE WHEN item_14 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item14,
                          (SUM(CASE WHEN item_15 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item15,
                          (SUM(CASE WHEN item_16 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item16,
                          (SUM(CASE WHEN item_17 = 'Favourite/Save for later button' THEN 1 ELSE 0 END) / COUNT(*)) * 100 AS percentage_item17
                        FROM responses";
$result_percentage_17 = $conn->query($sql_percentage_item17);

if ($result_percentage_17 === false) {
    die("Error: " . $conn->error);
}

$row_percentage_17 = $result_percentage_17->fetch_assoc();



//Download responses
// SQL query to fetch all responses
$query = "SELECT * FROM responses";
$result = mysqli_query($conn, $query);

// Create a file pointer
$output = fopen("responses.csv", "w");

// Add column headers to the CSV
$headers = array("id", "item_1", "item_2", "item_3", "item_4", "item_5", "item_6", "item_7", "item_8", "item_9", "item_10", "item_11", "item_12", "item_13", "item_14", "item_15", "item_16", "item_17", "participant", "campus", "comments", "created_at");
fputcsv($output, $headers);

// Loop through the database results and add to the CSV
while ($row = mysqli_fetch_assoc($result)) {
    fputcsv($output, $row);
}

// Close the file pointer
fclose($output);

// Close the database connection
mysqli_close($conn);



?>


<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link rel="stylesheet" href="bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="styles.css">
        <title>Admin Statistics</title>
    </head>
    <body>
        <div class="container">
            <div class="row">
                <div class="col">
                    <a href="index.php" class="btn btn-success">Home</a>
                </div>
                <div class="col">
                    <a href="responses.csv" class="btn btn-primary" download="responses.csv">Download Responses</a>
                </div>
            </div>
            
            <h2>Admin Statistics</h2>
            <p>Total Submissions: <b><?php echo $row_submissions['submission_count']; ?></b></p>
        <table class="table">
            <thead class="thead-dark">
                <tr>
                    <th scope="col">Section</th>
                    <th scope="col">1st</th>
                    <th scope="col">2nd</th>
                    <th scope="col">3rd</th>
                    <th scope="col">4th</th>
                    <th scope="col">5th</th>
                    <th scope="col">6th</th>
                    <th scope="col">7th</th>
                    <th scope="col">8th</th>
                    <th scope="col">9th</th>
                    <th scope="col">10th</th>
                    <th scope="col">11th</th>
                    <th scope="col">12th</th>
                    <th scope="col">13th</th>
                    <th scope="col">14th</th>
                    <th scope="col">15th</th>
                    <th scope="col">16th</th>
                    <th scope="col">17th</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <th scope="row">Banner image</th>
                    <td><?php echo number_format($row_percentage_1['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_1['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Social share links</th>
                    <td><?php echo number_format($row_percentage_2['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_2['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Overview</th>
                    <td><?php echo number_format($row_percentage_3['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_3['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Apply button</th>
                    <td><?php echo number_format($row_percentage_4['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_4['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">How to apply</th>
                    <td><?php echo number_format($row_percentage_5['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_5['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Contact us button</th>
                    <td><?php echo number_format($row_percentage_6['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_6['percentage_item17'],2)." %"; ?></td>
                </tr><tr>
                    <th scope="row">Student stories</th>
                    <td><?php echo number_format($row_percentage_7['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_7['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Course details</th>
                    <td><?php echo number_format($row_percentage_8['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_8['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Industry accreditations</th>
                    <td><?php echo number_format($row_percentage_9['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_9['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Entry requirements</th>
                    <td><?php echo number_format($row_percentage_10['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_10['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Fees & funding</th>
                    <td><?php echo number_format($row_percentage_11['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_11['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Careers</th>
                    <td><?php echo number_format($row_percentage_12['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_12['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Course specific stats</th>
                    <td><?php echo number_format($row_percentage_13['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_13['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Related courses</th>
                    <td><?php echo number_format($row_percentage_14['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_14['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Testimonials</th>
                    <td><?php echo number_format($row_percentage_15['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_15['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Environmental considerations</th>
                    <td><?php echo number_format($row_percentage_16['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_16['percentage_item17'],2)." %"; ?></td>
                </tr>
                <tr>
                    <th scope="row">Favourite/Save for later button</th>
                    <td><?php echo number_format($row_percentage_17['percentage_item1'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item2'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item3'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item4'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item5'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item6'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item7'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item8'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item9'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item10'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item11'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item12'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item13'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item14'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item15'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item16'],2)." %"; ?></td>
                    <td><?php echo number_format($row_percentage_17['percentage_item17'],2)." %"; ?></td>
                </tr>
            </tbody>
        </table>
        <a href="logout.php" class="btn btn-danger">Logout</a>
        </div>
        
    </body>
</html>