<html>
<head>
<title>Web management</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-7">
<link rel="stylesheet" href="../styles.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="10">
<p> 
      <?php 
			include 'connect.php';
if ($submit) {
	$sql="UPDATE roomspecs SET category_id='$category_id', room_id='$room_id', name='$name', name_en='$name_en', name_de='$name_de', publish='$publish', priority='$priority' WHERE id='$id'";
	$result = mysql_query($sql);	
?>
<table width="600" border="1" cellspacing="0" cellpadding="0" align="center" class="webadmintext" bordercolor="#999999">
  <tr> 
    <td bgcolor="#666666" bordercolor="#666666"> 
      <div align="center" class="white">TO ΧΑΡΑΚΤΗΡΙΣΤΙΚΟ ΑΛΛΑΞΕ</div>
    </td>
  </tr>
  <tr> 
    <td bordercolor="#FFFFFF">&nbsp;</td>
  </tr>
  <tr> 
    <td bordercolor="#FFFFFF"> 
      <div align="center"><b> 
        <?php echo $name   ?>
        </b> </div>
    </td>
  </tr>
  <tr> 
    <td bordercolor="#FFFFFF">&nbsp; </td>
  </tr>
</table>
<meta http-equiv="refresh" content="0;URL=edit-roomspec.php?id=<?php echo $id ?>">
<?php
} else {	
			$result = mysql_query("SELECT * FROM roomspecs WHERE id=$id",$dbh);
			$myrow=mysql_fetch_array($result); 
			$sid=$myrow['id'];
			$category_id=$myrow['category_id'];
			$room_id=$myrow['room_id'];
			$name=$myrow['name'];
			$name_en=$myrow['name_en'];
			$name_de=$myrow['name_de'];
			$publish=$myrow['publish'];
			$priority=$myrow['priority'];

			$result = mysql_query("SELECT * FROM specscategories WHERE id=$category_id",$dbh);
			$myrow=mysql_fetch_array($result); 
			$id1=$myrow['id'];
			$category=$myrow['category'];
			
			$result = mysql_query("SELECT * FROM rooms WHERE id=$room_id",$dbh);
			$myrow=mysql_fetch_array($result); 
			$id2=$myrow['id'];
			$room=$myrow['name'];
?>

<form name="forma" method="post" action="<?php echo $PHP_SELF ?>" enctype="multipart/form-data">
  <table width="600" border="1" cellspacing="0" cellpadding="0" align="center" class="webadmintext" bordercolor="#999999">
    <tr> 
      <td bgcolor="#666666" bordercolor="#666666"> 
        <div align="center" class="white">ΑΛΛΑΓΗ ΧΑΡΑΚΤΗΡΙΣΤΙΚΟΥ</div>
      </td>
    </tr>
    <tr> 
      <td bordercolor="#FFFFFF">&nbsp; </td>
    </tr>
    <tr> 
      <td bordercolor="#FFFFFF"> 
        <table width="100%" border="0" cellspacing="1" cellpadding="2" class="webadmintext" bgcolor="#F2F2F2">
          <tr> 
            <td width="30%">Κατηγορία 
              <input type="hidden" name="id" value="<?php echo $id ?>">
            </td>
            <td> 
              <select name="category_id" class="forms">
                <?php 
			include 'connect.php';
			$sql = "SELECT * FROM specscategories ORDER BY priority";
			$result = mysql_query($sql);
			while ($myrow=mysql_fetch_array($result)) {
				$id1=$myrow['id'];
				$category=$myrow['category'];
?>
                <?php
	if ($id1 == $category_id ) {
?>
                <option value="<?php echo $id1 ?>" selected> 
                <?php echo $category ?>
                <?php } else { ?>
                <option value="<?php echo $id1 ?>"> 
                <?php echo $category ?>
                </option>
                <?php 
				}
				}
?>
              </select>
            </td>
          </tr>
          <tr> 
            <td width="30%">Δωμάτιο</td>
            <td> 
              <select name="room_id" class="forms">
                <?php 
			include 'connect.php';
			$sql = "SELECT * FROM rooms ORDER BY priority";
			$result = mysql_query($sql);
			while ($myrow=mysql_fetch_array($result)) {
				$id2=$myrow['id'];
				$room=$myrow['name'];
?>
                <?php
	if ($id2 == $room_id ) {
?>
                <option value="<?php echo $id2 ?>" selected> 
                <?php echo $room ?>
                <?php } else { ?>
                <option value="<?php echo $id2 ?>"> 
                <?php echo $room ?>
                </option>
                <?php 
				}
				}
?>
              </select>
            </td>
          </tr>
          <tr> 
            <td width="30%">Ονομασία - ελληνικά*</td>
            <td> 
              <input type="text" name="name" value="<?php echo $name ?>" class="forms" size="60">
            </td>
          </tr>
          <tr> 
            <td width="30%">Ονομασία - αγγλικά*</td>
            <td> 
              <input type="text" name="name_en" value="<?php echo $name_en ?>" class="forms" size="60">
            </td>
          </tr>
          <tr> 
            <td width="30%">Ονομασία - γερμανικά</td>
            <td> 
              <input type="text" name="name_de" class="forms" size="60" value="<?php echo $name_de ?>">
            </td>
          </tr>
          <tr> 
            <td width="30%">Δημοσίευση στο site?</td>
            <td> 
              <?php if ($publish!=no) { ?>
              <select name="publish" class="forms">
                <option value="yes" selected>yes</option>
                <option value="no">no</option>
              </select>
              <?php }else{?>
              <select name="publish" class="forms">
                <option value="yes">yes</option>
                <option value="no" selected>no</option>
              </select>
              <?php } ?>
            </td>
          </tr>
          <tr> 
            <td width="30%">Αριθμός προτεραιότητας</td>
            <td> 
              <input type="text" name="priority" maxlength="11" value="<?php echo $priority ?>" class="forms" size="20">
            </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF" bordercolor="#FFFFFF">&nbsp;</td>
    </tr>
    <tr bgcolor="#666666"> 
      <td bgcolor="#666666" bordercolor="#666666"> 
        <table width="300" border="0" cellspacing="0" cellpadding="0" align="center">
          <tr> 
            <td> 
              <div align="center"> 
                <input type="submit" name="submit" value="Καταχώρηση" class="button">
              </div>
            </td>
            <td> 
              <div align="center"> 
                <input type="reset" name="Submit2" value="Επαναφορά" class="button">
              </div>
            </td>
          </tr>
        </table>
      </td>
    </tr>
  </table>
</form>
<?php } ?>
<table width="600" border="0" cellspacing="0" cellpadding="4" align="center">
  <tr>
    <td>
      <div align="center"> <a href="javascript:history.go(-1);"><img src="back.gif" alt="πίσω" border="0"></a> 
        &nbsp; <a href="#top"><img src="top.gif" border="0" alt="πάνω"></a> 
      </div>
    </td>
  </tr>
</table>
</body>
</html>
