<?
if($_POST["review"]){
$id = intval($_POST["id"]);
$review = intval($_POST["review"]);
$num = mysql_num_rows(mysql_query("SELECT id FROM url WHERE id = '".$id."'"));
if($num>0){
mysql_query("UPDATE url SET review = '$review' WHERE id = '".$id."'");
?>
<div class='w_ok'><div class='wmsg'>Сайт успешно отредактирован</div></div>
<?
}
}
if($_POST["id"]){
$id = intval($_POST["id"]);
$review = intval($_POST["review"]);
$num = mysql_num_rows(mysql_query("SELECT id FROM url WHERE id = '".$id."'"));
if($num>0){
$row = mysql_fetch_array(mysql_query("SELECT * FROM url WHERE id = '".$id."'"));
?>
<form method="post" action="">
<strong>ID:</strong> <?=$row['id'];?><br>
<strong>URL:</strong> <?=$row['url'];?><br>
<strong>Просмотры:</strong> <input type="text" name="review" value="<?=$row['review'];?>"><br>
<input type="submit" value="Сохранить">
</form>
<?
}else{
?>
<div class='w_warning'><div class='wmsg'>Сайт не найден</div></div>
<?
}
}?>
<form method="post" action="">
Введите ID сайта: <input type="text" name="id">
<input type="submit" class="submit_1" value="Поиск">
</form>
<form method="post" action="">
<strong>ID:</strong> <?=$row['id'];?><br>
<strong>URL:</strong> <?=$row['url'];?><br>
<strong>Просмотры:</strong> <input type="text" name="review" value="<?=$row['review'];?>"><br>
<input type="submit" value="Сохранить">
</form>
<input type="hidden" name="id" value="<?=$row['id'];?>">