<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"> 
  <?php 
if ($submit) {
			include 'connect.php';
			$sql = "INSERT INTO roomprices (room_id, season_id, price) VALUES ('$room_id', '$season_id', '$price')";
			$result = mysql_query($sql);
?>
<table width="700" 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"> 
      <div align="center"> 
       <b><?php echo $price ?></b>
        ΕΥΡΩ</div>
    </td>
  </tr>
  <tr> 
    <td bordercolor="#FFFFFF">&nbsp; </td>
  </tr>
</table>
<?php 
		  $nu_row1 = '0';
              $zero='0';
			include 'connect.php';
			$sql10 = "SELECT * FROM seasons";
			$result10 = mysql_query($sql10);
			$nu_row1 = mysql_num_rows($result10);
?>
                       
                        <?php 
             $nu_row2 = '0';
              $zero='0';
			include 'connect.php';
			$sql12 = "SELECT * FROM roomprices WHERE room_id='$roomid'";
			$result12 = mysql_query($sql12);
			$nu_row2 = mysql_num_rows($result12);
?>

                        <?php 
	if  ( ( $nu_row1==$nu_row2)) {
	?>
	<meta http-equiv="refresh" content="0;URL=all-rooms.php">

                        <?php } else {?>

<meta http-equiv="refresh" content="0;URL=new-roomprice.php?roomid=<?php echo $roomid ?>&room=<?php echo $room ?>">
<?php }?>

<?php			
}
else  {
?>
<form name="forma" method="post" action="">
  <table width="700" border="1" cellspacing="0" cellpadding="0" align="center" class="webadmintext" bordercolor="#999999">
    <tr> 
      <td bgcolor="#666666" bordercolor="#666666"> 
        <div align="center" class="white">ΠΡΟΣΘΗΚΗ ΤΙΜΗΣ για 
          <b><?php echo $room ?></b>
        </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> 
              <?php 
			include 'connect.php';
			$sql1 = "SELECT * FROM rooms WHERE  id='$roomid'";
			$result1 = mysql_query($sql1);
			while ($myrow=mysql_fetch_array($result1)) {
				$roomid=$myrow['id'];
?>
              <input type="hidden" name="room_id" value="<?php echo $roomid ?>">
              <?php } ?>
            </td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td>Σεζόν</td>
            <td> 
              <select name="season_id" class="forms">
                <?php 
			include 'connect.php';

			$sql = "SELECT * FROM seasons ORDER BY id";
			$result = mysql_query($sql);
			while ($myrow=mysql_fetch_array($result)) {
				$seasonid=$myrow['id'];
				$season=$myrow['season'];
?>
                <?php 
             $nu_row = '0';
              $zero='0';
			include 'connect.php';
			$sql4 = "SELECT * FROM roomprices WHERE room_id='$roomid' AND season_id='$seasonid'";
			$result4 = mysql_query($sql4);
			$nu_row = mysql_num_rows($result4);
?>
                <?php 
	if  ( ( $nu_row==$zero)) {
	?>
                <option value="<?php echo $seasonid ?>"> 
                <?php echo $season ?>
                </option>
                <?php } else {?>
                <?php }?>
                <?php }?>
              </select>
            </td>
          </tr>
          <tr> 
            <td width="25%">Τιμή ΕΥΡΩ / διανυκτέρευση</td>
            <td> 
              <input type="text" name="price" maxlength="11" size="30" class="forms">
            </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="700" 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>
