<!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']));
$name = mysql_real_escape_string(stripslashes($_REQUEST['name']));
$email = mysql_real_escape_string(stripslashes($_REQUEST['email']));
$address = mysql_real_escape_string(stripslashes($_REQUEST['address']));
$city = mysql_real_escape_string(stripslashes($_REQUEST['city']));
$tel = mysql_real_escape_string(stripslashes($_REQUEST['tel']));
$comments = mysql_real_escape_string(stripslashes($_REQUEST['comments']));

if  (isset($_POST['submit'])) {
	$sql="UPDATE nlmembers SET category_id='$category_id', name='$name', email='$email', address='$address', city='$city', tel='$tel', comments='$comments' WHERE id='$id'";
	$result = mysql_query($sql);	
?>
<meta http-equiv="refresh" content="0;URL=edit-nlmember.php?id=<?php echo $id ?>">
<?php
} else {	
			$result = mysql_query("SELECT * FROM nlmembers WHERE id='$id'",$dbh);
			$myrow=mysql_fetch_array($result); 
			$id=$myrow['id'];
			$category_id=$myrow['category_id'];
			$name=$myrow['name'];
			$email=$myrow['email'];
			$url=$myrow['url'];
			$address=$myrow['address'];
			$city=$myrow['city'];
			$tel=$myrow['tel'];
			$comments=$myrow['comments'];
			
?>

<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div><img src="img/frame-edit.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="id" value="<?php echo $id ?>">
  <table width="100%" border="0" cellspacing="0" cellpadding="4" class="text">
          <tr>
            <td width="20">&nbsp;</td> 
            <td width="200">Ομάδα 
              
            </td>
            <td> 
              <select name="category_id" class="forms">
                <?php
			$sql = "SELECT * FROM nlcategories ORDER BY id";
			$result = mysql_query($sql);
			while ($myrow=mysql_fetch_array($result)) {
				$catid1=$myrow['id'];
				$category1=$myrow['category'];
?>
                <?php
	if ($catid1 == $category_id ) {
?>
                <option value="<?php echo $catid1 ?>" selected> 
                <?php echo $category1 ?>
                <?php } else { ?>
                <option value="<?php echo $catid1 ?>"> 
                <?php echo $category1 ?>
                </option>
                <?php 
				}
				}
?>
              </select>
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td> 
            <td>Ονομα</td>
            <td> 
              <input type="text" name="name" size="100" class="forms" value="<?php echo $name ?>">
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td> 
            <td>E-mail</td>
            <td> 
              <input type="text" name="email" size="100" class="forms" value="<?php echo $email ?>">
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td> 
            <td>Διεύθυνση</td>
            <td> 
              <input type="text" name="address" size="100" class="forms" value="<?php echo $address ?>">
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td> 
            <td>Πόλη</td>
            <td> 
              <input type="text" name="city" size="100" class="forms" value="<?php echo $city ?>">
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td> 
            <td>Tel</td>
            <td> 
              <input type="text" name="tel" size="100" class="forms" value="<?php echo $tel ?>">
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td> 
            <td>Κείμενο</td>
            <td> 
              <textarea name="comments" cols="100" rows="6" class="forms"><?php echo $comments ?></textarea>
            </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-nlmembers.php?catid=<?php echo $category_id ?>" class="links">μεταφορά στην Λίστα</a></div></td>
  </tr>
</table><?php include 'menudown.php';?>
<?php } ?>
</body>
</html>
