<!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">
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
    
<div><img src="img/frame-list.png" width="180" height="37" alt=""></div>
<div class="frame">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="text">
  <tr>
    <td align="center"><div class="titles">
      <?php
			$sql = "SELECT * FROM nlcategories";
			$result = mysql_query($sql);
			$nu_row = mysql_num_rows($result);
?>
      <?php echo $nu_row  ?></div></td>
  </tr>
  <tr>
    <td><?php
			$sql = "SELECT * FROM nlcategories ORDER BY id";
			$result = mysql_query($sql);
	while ($myrow=mysql_fetch_array($result)) {
			$id=$myrow['id'];
			$category=$myrow['category'];
			$email=$myrow['email'];
			$url=$myrow['url'];
			$address=$myrow['address'];
			$city=$myrow['city'];
			$tel=$myrow['tel'];
			$fax=$myrow['fax'];
			$comments=$myrow['comments'];
?></td>
  </tr>
  <tr>
    <td>
    <table width="100%" border="0" cellspacing="1" cellpadding="4" class="text">
        <tr valign="top" bgcolor="#F2F2F2">
          <td width="300"><b> <?php echo $category ?></b>
            <hr>
            <table width="100%" border="0" cellspacing="0" cellpadding="2" class="text">
              <tr>
                <td valign="top" width="80">Διεύθυνση</td>
                <td valign="top"><?php echo $address ?> <br>
                  <?php echo $city ?></td>
              </tr>
              <tr>
                <td valign="top">Tel.</td>
                <td valign="top"><?php echo $tel ?></td>
              </tr>
              <tr>
                <td valign="top">Fax</td>
                <td valign="top"><?php echo $fax ?></td>
              </tr>
              <tr>
                <td valign="top">E-mail</td>
                <td valign="top"><a href="mailto:<?php echo $email ?>?subject=<?php echo $firma?> Newsletter" class="links"> <?php echo $email ?></a></td>
              </tr>
              <tr>
                <td valign="top">Website</td>
                <td valign="top"><a href="http://<?php echo $url ?>" class="links" target="_blank"> <?php echo $url ?></a></td>
              </tr>
            </table></td>
          <td><?php
			$sql3 = "SELECT * FROM nlmembers WHERE category_id='$id'";
			$result3= mysql_query($sql3);
			$nu_row3 = mysql_num_rows($result3);
?>
            <?php 
	if  ( ( $nu_row3==0)) {
	?>
            <?php echo $category ?>
            <?php } else {?>
            <a href="all-nlmembers.php?catid=<?php echo $id?>" class="links"> <?php echo $category ?></a> <b> [<?php echo $nu_row3  ?>] </b>
            <?php } ?></td> 
          <td width="70" align="center">
            <div style="margin-top:3px"><a href="edit-nlcategory.php?id=<?php echo $id?>" class="link">ΑΛΛΑΓΗ</a></div>
          </td>
          <td width="70" align="center"> 
          <?php if ($id!=1) { ?>
          
                <?php
if  (isset($_POST['submit'])) {
$sql10="DELETE FROM nlcategories WHERE id='{$_REQUEST['id']}'";
	$result10=mysql_query($sql10);	
	
$sql11="UPDATE nlmembers SET category_id='1' WHERE category_id='{$_REQUEST['id']}'";
	$result11=mysql_query($sql11);	
?>
 <meta http-equiv="refresh" content="0;URL=all-nlcategories.php">   
 <?php } ?>       
<form name="forma" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data" style="margin:0; padding:0">
 <input type="hidden" name="id" value="<?php echo $id ?>">
           <input type="submit" name="submit" value="ΔΙΑΓΡΑΦΗ" class="link"></form>
  
  <?php } ?>          
          </td>
        </tr>
      </table>
    <hr></td>
  </tr>
  <tr>
    <td><?php } ?></td>
  </tr>
</table>
</div>
</td>
  </tr>
</table>
<?php include 'menudown.php';?>
</body>
</html>
