I want to display images based on what user checked from number of checkboxs. I'm trying this code, but it not working

<!Doctype html>
<html><body>
<form method="post" action="" id="myForm">
    <div class="opt-first">
    <h1><b>Subject</b></h1>
        <input type="checkbox" value="Account/Finance" name="subject[]" /> Account/Finance<br />
        <input type="checkbox" value="Marketing" name="subject[]" /> Marketing<br />
        <input type="checkbox" value="" name="subject[]" /> Other
    </div>

    <div class="opt">
    <h1><b>Type</b></h1>
        <input type="checkbox" value="Exam" name="Type[]" /> Exam<br />
        <input type="checkbox" value="Project" name="Type[]" /> Project<br />
        <input type="checkbox" value="Assignment" name="Type[]" /> Assignment
    </div>

    <div >
    <h1><b>Tasks</b></h1>
        <input type="checkbox" value="Report" name="Task[]" /> Report<br />
        <input type="checkbox" value="Presentation" name="Task[]" /> Presentation<br />
        <input type="checkbox" value="Assay" name="Task[]" /> Assay<br />
        <input type="checkbox" value="Case study" name="Task[]" /> Case study<br />
        <input type="checkbox" value="Teaching" name="Task[]" /> Teaching<br/>
        <input type="checkbox" value="Website Design" name="Task[]" /> Website Design<br/>
        <input type="checkbox" value="Short Answer" name="Task[]" /> Short Answer

    </div>
    <div><h1><b>Group/Individual </b></h1>
            <input type="checkbox" value="Yes" name="member[]" /> Group Work<br />
        <input type="checkbox" value="" name="member[]" /> Individual <br />
</div>    
    <input type="submit" value="Show" class="submit" />
</form>

<?php

if (isset($_POST['Subject']) && isset($_POST['Type']) && isset($_POST['Task'])&& isset($_POST['member']))
{
    $con=mysqli_connect("localhost","FYP","123","FYP");
echo "<div>";

    foreach ($_POST['Subject'] as $Subject)
    {
        foreach ($_POST['Type'] as $Type)
        {
            foreach ($_POST['Task'] as $Task)
            {
                foreach ($_POST['member'] as $member)
                {
                $sql= mysqli_query($con, "SELECT R_Name FROM rubric_sample WHERE Subject='$Subject' AND Type='$Type' AND Task='$Task' AND Group='$member'");
                while($row = mysqli_fetch_array($sql)){
                    echo "<img src='/Rubrics/".$row['R_Name']." alt='Rubrics Sample ' style='width:128px;height:128px'>";
                }
                }
            }
        }
    }

  echo "</div>";
}

?>

</body></html>

Could you please help me to correct my code or suggest me a better way to do it

this code will display all courses user has

<h1>YOUR COURSES</h1> <form action="delete.php" method="POST"><ol>
    <?php
    $con=mysqli_connect("localhost","FYP","123","FYP");
$sql= mysqli_query($con, "SELECT C_Code FROM F_COURSES WHERE F_ID=".$_SESSION['userid']);
while($row = mysqli_fetch_array($sql)){
echo "<li name='course'>".$row['C_Code']."<input type='submit'  value='Delete'>";}

    ?></ol></form>

I need when user click on delete button that course delete from F_courses

<?php
session_start();
if (! empty($_SESSION['logged_in']))
{
    $con=mysqli_connect("localhost","FYP","123","FYP");
    $id=$_SESSION['userid'];
    $course=$_POST["course"];

            $sql="DELETE FROM F_COURSES WHERE F_ID='$id' AND C_Code='$course'";
            mysqli_query($con,$sql);

            header ("location: mycourses.php");

}
else
{
    echo 'You are not logged in. <a href="login.html">Click here</a> to log in.';
}

Could you please help me how to correct my code
Thank you

@ips What you recommend me to do instead of duplicating the rows by the way I will then store the data in the database after user finish his questions

I'm trying to determine the value of $level based on the keyword user provide using If statement
but whatever was the user entry the value of $level always giving as 1
this is my code I need your help to find the error

<?php
$q1 = $_GET['q1'];
$con = mysqli_connect("localhost","FYP","123","FYP");
if (!$con) {
    die('Could not connect: ' . mysqli_error($con));}

mysqli_select_db($con,"ajax_demo");
if ($q1=="Cite"||"Define"||"Enumerate"||"Index"||"Indicate"){
$level=1;}
elseif($q1=="Add"||"Approximate"||"Articulate"||"Associate")
{
$level=2;
}
elseif($q1=="Acquire"||"Adapt"||"Allocate"||"Alphabetize") 
{
    $level=3;
    }
elseif($q1=="Analyze"||"Analyse"||"Audit"||"Blueprint"||"Breadboard" ) 
{
    $level=4;
    }
elseif($q1=="Abstract"||"Animate"||"Arrange"||"Assemble" ) 
{
    $level=5;
    }
elseif($q1=="Appraise"||"Assess"||"Conclude"||"Counsel") 
{
    $level=6;
    }
else{$level=0;}
echo $level;
?>

I'm trying to addrow onclick button, and I need that new row would have the diffrent ids for "keyword" and "chapter" so I can pass the values of these two field in CLO(key, chap)
I can only call the CLO() function in orginal row I need to be able to call it in added row and get that row keyword and chapter
this my code, could you please help me with the code .thank you

    <html><head>
    <script>
            function addRow(tableID){
        var table=document.getElementById(tableID);
         var rowCount=table.rows.length;
        var row=table.insertRow(rowCount);
        var colCount=table.rows[1].cells.length;
        var cell1=row.insertCell(0);
        cell1.innerHTML= rowCount+1;
        for(var i=0;i<colCount;i++){
        var newcell=row.insertCell(i+1);
        newcell.innerHTML=table.rows[1].cells[i+1].innerHTML;

        }}
    function CLO() {
    var a=document.getElementById("keyword").value;
    var b=document.getElementById("chapter").value;
        if (a == ""&& b == "") {
            document.getElementById("CLO").innerHTML = "";

            return;
        } else { 
         if (window.XMLHttpRequest) {
                // code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            } else {
                // code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    document.getElementById("CLO").innerHTML = xmlhttp.responseText;

                }
            }

           xmlhttp.open("GET","PLO.php?q1="+escape(a)+"&q2="+escape(b),true);
    xmlhttp.send();
        }
    }

        </script>
        </head><body><form>
        <input type="button" value="Add Question" onclick="addRow('dataTable')"><br> <br>

        <table id="dataTable" >
        <tr><th>Q</th><th>Keyword</th>
    <th>Chapter</th>
    <th>CLO</th> 
    <th> Marks</th></tr>
    <tr><td> 1</td><td> <input type="text" name="keyword" id="keyword" > </td> 
     <td> &nbsp;&nbsp; <select name="chapter" id="chapter" onchange="CLO()"> <option value="" >  </option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>

    </select></td>

    <td id="CLO"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>  </td>

    <td> <input type="text" name="Assess_Mark"> </td></tr>

    </table><form></body></html>

I'm trying to do something like this

$level=0;
if($a=="x"){
$level=1;
}
Else{ $level=2;}

How I can use the new value of $level outside the scope of IF Statement

I have this code to add row to my table

    function addRow(tableID){
    var table=document.getElementById(tableID);
     var rowCount=table.rows.length;
    var row=table.insertRow(rowCount);
    var colCount=table.rows[0].cells.length;
    var cell1=row.insertCell(0);
    cell1.innerHTML= rowCount+1;
    for(var i=0;i<colCount;i++){
    var newcell=row.insertCell(i+1);
    newcell.innerHTML=table.rows[0].cells[i+1].innerHTML;
    }}

and this for AJAX function

    function CLO() {
    var a=document.getElementById("keyword").value;
    var b=document.getElementById("chapter").value;
        if (a == ""&& b == "") {
         document.getElementById("CLO").innerHTML = "";

        return;
            } else { 
     if (window.XMLHttpRequest) {
            // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        } else {
            // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                document.getElementById("CLO").innerHTML = xmlhttp.responseText;

            }
        }

        xmlhttp.open("GET","PLO.php?q1="+escape(a)+"&q2="+escape(b),true);
        xmlhttp.send();
             }
            }

How I can use the same function in the added rows
it working in the first row
I need you recommendation and help
thank you

I already have the session_start(); at the top of both pages
what is the right way to do this
and thank you for you help

I have images generated by while loop php based on how many course user have
when user press on one of those images it will send him to that course page
but all images send to one course page
this my php code in home page

 <?php
    $con=mysqli_connect("localhost","FYP","123","FYP");
    $sql= mysqli_query($con, "SELECT C_Code FROM F_COURSES WHERE F_ID=".$_SESSION['userid']);
       while($row = mysqli_fetch_array($sql)){
       echo " <a href='course.php'><div class='cc' id='tres'><img class='icon' src='bookicon1.png'><p   class='pra'>".$row['C_Code']."</p></div></a>&nbsp;";
       $C_Code = $row['C_Code'];
       $_SESSION['course'] = $C_Code;}

  ?>

and this code for course page

 this is    <?php
            echo      $_SESSION['course'];
      ?> course. 

I hope my question make sense and I appreciate your help

I'm trying to create a webpage to help teacher determine CLO and PLO for exam questions
First user will type the keyword in text box and select the chapter CLO() function will start the AJAX the result should be a CLO Number in CLO column and PLO options in PLO column. it is my first time using AJAX so I'm not should what is wrong
this is my code
HTML Page

<! Doctype html>
    <head>
    <script>function CLO() {
    var a=document.getElementById("keyword").value;
    var b=document.getElementById("chapter").value;
        if (a == ""&& b == "") {
            document.getElementById("CLO").innerHTML = "";
            document.getElementById("PLO").innerHTML = "";
            return;
        } else { 
         if (window.XMLHttpRequest) {
                // code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            } else {
                // code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    document.getElementById("CLO").innerHTML = xmlhttp.responseText;
                    document.getElementById("PLO").innerHTML = xmlhttp.responseText;
                }
            }

           xmlhttp.open("GET","plo.php?q1="+a+"q2="+b,true);
    xmlhttp.send();
        }
    }
        </script>
    </head>
    <body><form><table id="dataTable" >
    <tr><th>Q </th><th>Keyword</th><th>Chapter</th><th>CLO</th> <th>PLO</th><th> Marks</th></tr>
    <tr><td> 1</td><td> <input type="text" name="keyword[]" id="keyword" > </td> 
     <td> Chapter: <select name="chapter[]" id="chapter" onchange="CLO()"> <option value="" >  </option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>

    </select></td>

    <td id="CLO"> gghjgh</td>  </td>
    <td><select name="PLO" id="PLO"> <option >  </option>
    </select></td>
    <td> <input type="text" name="mark[]"> </td></tr>

    </table></form>

PHP Page

<!DOCTYPE html>
<html>
<head>

</head>
<body>

<?php
$q1 = intval($_GET['q1']);
$q2 = intval($_GET['q2']);
$con = mysqli_connect("localhost","FYP","123","FYP");
if (!$con) {
    die('Could not connect: ' . mysqli_error($con));}

mysqli_select_db($con,"ajax_demo");
$level=0;
if ($q1=="Cite" || "Define "){
return $level=1;}
elseif ($q1==""){
    return $level=2;
}
$sql1="SELECT * FROM SYLL_INFO WHERE ...