I have a classrooms in schools and when I click on a certain classroom, I want to add students into it but my actual code is doing something stupid. It adds a student but i can see the student in all classrooms, not just in the one that i added him into. So when Im in classroom number 1, I see a form in there, I can add a student there, ... see how it works here: 

here is the code: <http://www.xxxx.xx/projekt/>

here is my code in file trieda.php

```
    <table align="center"><tr><td>
<form action="vlozit2.php" method="post">
  Meno: <input type="text" name="meno" placeholder="Janko" maxlength="15" required>
  Priezvisko: <input type="text" name="priezvisko" placeholder="Hruška" maxlength="20" required>
  <input type="hidden" name="id_triedy" value="<?= $trieda['id_triedy'] ?>" />
  <input type="submit" name="submit" value="Pridať študenta do triedy">
</form>
</td></tr></table>

<?php 
$result = mysqli_query($prip,"SELECT * FROM student ORDER BY meno");

while($student = mysqli_fetch_array($result))
{
    echo "<br /><table cellspacing='1' cellpadding='1' class='tabulka1' align='center'><tr>";
    echo "<td width='200'><a href='student.php?id_triedy=".$trieda['id_triedy']."".id_student=".$student['id_student']."'>".$student['meno']." ".$student['priezvisko']."</a></td>";
    ?>
  <td width='300px' align='right' bgcolor="#fbfbfb"><a href="zmazat_studenta.php?id_student=<? echo $student['id_student']; ?>">Zmazať</a></td>
  </tr></table>
<?php 
  }
?>  

```

here is vlozit2.php (a code that works for the form to add a student)

```
    if(isset($_POST['submit']))
{

    //meno a priezvisko
    $student = $_POST['meno'];
    $student = $_POST['priezvisko'];
    $trieda = $_POST['id_triedy'];

    //connect to the database
    include 'config.php';

    //insert results from the form input
    $sql = "INSERT INTO student (meno, priezvisko, id_triedy) VALUES('$_POST[meno]', '$_POST[priezvisko]', '$_POST[id_triedy]')";

        $add = "<table align='center'>
                <tr>
                    <td> Študent bol úspešne pridaný do triedy. </td>
                </tr>
                <tr>
                    <td><a href='./trieda.php'><strong>Späť</strong></a></td>
                </tr>
                </table>";
        $not_add = "<table align='center'>
                <tr>
                    <td> Študent s týmto menom a priezviskom už je v tejto triede. </td>
                </tr>
                <tr>
                    <td><a href='./trieda.php'><strong>Späť</strong></a></td>
                </tr>
                </table>";

        if (mysqli_query($prip, $sql)) {
            echo $add;
        }else{
            echo $not_add;
            }

    mysqli_close($prip);
    }
    ?>

```