<html>
<?php

$con = new mysqli("localhost","root","toor","museam_db");
mysqli_set_charset($con, 'utf8');

// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$super_name=$_POST['isdb'];
$super_id=$_POST['isid'];

if(!isset($_POST['isid'])||!isset($_POST['isdb']))
	echo'Cannot get packets';



?>

<? if (isset($_POST['isdb']) && $_POST['isdb']=="room"){ ?>

<select name="agalm_seat" class="form-control" onchange="bring_savechoice(<?=$_POST['isid']?>,this.value)">
    <?php
        $query = "SELECT id,cap FROM room WHERE id=".$_POST['isid']." ORDER BY num ASC;";
        $result=mysqli_query($con, $query);  
            if($result)
                while($row=$result->fetch_assoc())
                  for ($i=1;$i<=$row['cap'];$i++){
                ?> <option value="<?=$i?>"> <?= 'Θέση'.$i?> </option> <?php
        }

    ?>
    <option value="" disabled="" selected="">-----Θέση-----</option>

<? }
 ?>
</html>


