<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Web management</title>
<link rel="stylesheet" href="styles.css" type="text/css">
<?php include 'codes.php';?>
</head>
<body text="#000000" style="margin:0">
  <?php
$id = mysql_real_escape_string(stripslashes($_REQUEST['id']));
$category_id = mysql_real_escape_string(stripslashes($_REQUEST['category_id']));
$room_id = mysql_real_escape_string(stripslashes($_REQUEST['room_id']));	  
$name = mysql_real_escape_string(stripslashes($_REQUEST['name']));
$name_en = mysql_real_escape_string(stripslashes($_REQUEST['name_en']));
$name_de = mysql_real_escape_string(stripslashes($_REQUEST['name_de']));
$name_fr = mysql_real_escape_string(stripslashes($_REQUEST['name_fr']));
$name_it = mysql_real_escape_string(stripslashes($_REQUEST['name_it']));
$name_es = mysql_real_escape_string(stripslashes($_REQUEST['name_es']));
$name_ru = mysql_real_escape_string(stripslashes($_REQUEST['name_ru']));
$name_zh = mysql_real_escape_string(stripslashes($_REQUEST['name_zh']));
$publish = mysql_real_escape_string(stripslashes($_REQUEST['publish']));	  
$priority = mysql_real_escape_string(stripslashes($_REQUEST['priority']));	  

			$sql1 = "SELECT * FROM specs ORDER BY id";
			$result1 = mysql_query($sql1);
	while ($myrow=mysql_fetch_array($result1)) {
			$pid=$myrow['id'];
			
}?>
<?php if ($pid=='') { 
$priorityid=1;
}
else {
$priorityid=$pid * 10;
}?>

<?php 
if  (isset($_POST['submit'])) {
			$sql = "INSERT INTO specs (category_id, room_id, name, name_en, name_de, name_fr, name_it, name_es, name_ru, name_zh, publish, priority) VALUES ('$category_id', '$roomid', '$name', '$name_en', '$name_de', '$name_fr', '$name_it', '$name_es', '$name_ru', '$name_zh', '$publish', '$priorityid')";
			$result = mysql_query($sql);
?>
<meta http-equiv="refresh" content="0;URL=new-spec.php?roomid=<?php echo $roomid ?>">
<?php			
}
else  {
?>

<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div><img src="img/frame-add.png" width="180" height="37" alt=""></div>
<div class="frame">
<form name="forma" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data">
  <input type="hidden" name="roomid" value="<?php echo $roomid ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="text">
  <tr>
            <td width="20">&nbsp;</td> 
            <td width="200">Κατηγορία 
           
           <?php
            $result = mysql_query("SELECT * FROM rooms WHERE id='{$_REQUEST['roomid']}'",$dbh);
			$myrow=mysql_fetch_array($result); 
			$roomid=$myrow['id'];
			$room=$myrow['name'];
			
?></td>
            <td> 
              <select name="category_id" class="forms">
                <?php
			$sql1 = "SELECT * FROM specscategories ORDER BY priority";
			$result1 = mysql_query($sql1);
			while ($myrow=mysql_fetch_array($result1)) {
				$category_id=$myrow['id'];
				$category=$myrow['category'];
?>
                <option value="<?php echo $category_id ?>"> 
                <?php echo $category ?>
                </option><?php } ?>
              </select>
              
              <b><?php echo $room ?></b>
            </td>
          </tr>
           <?php if ($lang1==1) { ?>
    <tr>
      <td width="20"><img src="img/lang1.png" width="16" height="16" alt=""></td> 
      <td width="200">Κείμενο 
        </td>
      <td><textarea name="name" rows="6" class="mceEditor"></textarea>
        </td>
    </tr>
    <?php } ?>
    <?php if ($lang2==1) { ?>
    <tr>
      <td><img src="img/lang2.png" width="16" height="16" alt=""></td> 
      <td>Κείμενο </td>
      <td><textarea name="name_en" rows="6" class="mceEditor"></textarea>
        </td>
      </tr>
      <?php } ?>
    <?php if ($lang3==1) { ?>
    <tr>
      <td><img src="img/lang3.png" width="16" height="16" alt=""></td>
      <td>Κείμενο </td>
      <td><textarea name="name_de" rows="6" class="mceEditor"></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang4==1) { ?>
    <tr>
      <td><img src="img/lang4.png" width="16" height="16" alt=""></td>
      <td>Κείμενο </td>
      <td><textarea name="name_fr" rows="6" class="mceEditor"></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang5==1) { ?>
    <tr>
      <td><img src="img/lang5.png" width="16" height="16" alt=""></td>
      <td>Κείμενο </td>
      <td><textarea name="name_it" rows="6" class="mceEditor"></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang6==1) { ?>
    <tr>
      <td><img src="img/lang6.png" width="16" height="16" alt=""></td>
      <td>Κείμενο </td>
      <td><textarea name="name_es" rows="6" class="mceEditor"></textarea></td>
    </tr>
      <?php } ?>
    <?php if ($lang7==1) { ?>
    <tr>
      <td><img src="img/lang7.png" width="16" height="16" alt=""></td>
      <td>Κείμενο </td>
      <td><textarea name="name_ru" rows="6" class="mceEditor"></textarea></td>
    </tr>
      <?php } ?>
      <?php if ($lang8==1) { ?>
    <tr>
      <td><img src="img/lang8.png" width="16" height="16" alt=""></td>
      <td>Κείμενο </td>
      <td><textarea name="name_zh" rows="6" class="mceEditor"></textarea></td>
    </tr>
      <?php } ?>
          <tr>
            <td>&nbsp;</td> 
            <td>Δημοσίευση στο site?</td>
            <td> 
              <select name="publish" class="forms">
                <option value="yes" selected>yes</option>
                <option value="no">no</option>
                </select>
              </td>
          </tr>
        </table>

  <div align="center" style="padding:5px">
   <input type="submit" name="submit" value="Καταχώρηση" class="button">
        <input type="reset" name="reset" value="Επαναφορά" class="button">  </div>
</form>  
</div>
<div align="right"><a href="all-specs.php?roomid=<?php echo $roomid ?>" class="links">μεταφορά στην Λίστα</a></div></td>
  </tr>
</table><?php include 'menudown.php';?>
<?php } ?>
</body>
</html>
