<!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>
<?php 
$id = mysql_real_escape_string(stripslashes($_REQUEST['id']));
?>
<?php
$result = mysql_query("SELECT * FROM links WHERE id='$id'",$dbh);
$myrow=mysql_fetch_array($result); 
$name=$myrow['name'];
$url=$myrow['url'];
$publish=$myrow['publish'];
$priority=$myrow['priority'];
?>

<?php 
if  (isset($_POST['submit'])) {

$name = mysql_real_escape_string(stripslashes($_REQUEST['name']));
$url = mysql_real_escape_string(stripslashes($_REQUEST['url']));	  
$publish = mysql_real_escape_string(stripslashes($_REQUEST['publish']));	  
$priority = mysql_real_escape_string(stripslashes($_REQUEST['priority']));	  

$sql="UPDATE links SET  name='$name', url='$url', publish='$publish', priority='$priority' WHERE id='$id'";
$result = mysql_query($sql);

} ?>

<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">
    <tr>
      <td width="20">&nbsp;</td> 
      <td width="200">Τίτλος 
        </td>
      <td> 
        <input type="text" name="name" size="100" value="<?php echo $name ?>" class="forms">
        </td>
    </tr>
    <tr>
      <td width="20">&nbsp;</td>
      <td width="200">URL*</td>
      <td><input type="text" name="url" value="<?php echo $url ?>" class="forms" size="100"></td> 
    </tr>
    <tr>
      <td>&nbsp;</td> 
      <td>Δημοσίευση στο site?</td>
      <td> 
        <select name="publish" class="forms">
          <?php if ($publish==yes) { ?>
          <option value="yes" selected>yes</option>
          <option value="no">no</option>
          <?php }else{?> 
          <option value="no" selected>no</option>
          <option value="yes">yes</option>
          <?php } ?>
</select>
        </td>
    </tr>
    <tr>
      <td>&nbsp;</td> 
      <td>Αριθμός προτεραιότητας</td>
      <td> 
        <input type="text" name="priority" size="20" maxlength="11" value="<?php echo $priority ?>" class="forms">
        </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-links.php" class="links">μεταφορά στην Λίστα</a></div></td>
  </tr>
</table><?php include 'menudown.php';?>
</body>
</html>
