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>
<form method="post" action="" id="myForm">
    <div class="opt-first">
        <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 class="opt">
        <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 >
        <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><h1><b>Group/Individual </b></h1>
            <input type="checkbox" value="Yes" name="member[]" /> Group Work<br />
        <input type="checkbox" value="" name="member[]" /> Individual <br />
    <input type="submit" value="Show" class="submit" />


if (isset($_POST['Subject']) && isset($_POST['Type']) && isset($_POST['Task'])&& isset($_POST['member']))
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>";



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

3 Years
Discussion Span
Last Post by diafol

That's all wrong.

Firstly how are your images stored? Are they categorized or do they have "tags"?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.