<?

include '../../config.php';
include '../../func.php';
head();


$id = num($_GET['id']);
$razdel = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_razdel` WHERE `id` = '".$id."'"));

if ( empty($razdel['id']) ) {
    
    echo link2 . 'Раздел не найден' . div;
    navig();
    foot();
    exit();
    
}
if ( isset($_POST['submit']) ) {
    
    $name = html($_POST['name']);
    
    if ( empty($name) ) {
        header('Location: index.php?mod=empty_name&result=error');
    } else {
    $result = mysql_query("UPDATE `forum_razdel` SET `name` = '".$name."'WHERE `id` = '".$id."'");
    if ( $result != NULL ) {
        
        header('Location: index.php?mod=razdel_edit&result=good');
        
    } else {
        
        header('Location: index.php?mod=razdel_edit&result=error');
        
    }
    
    }
    
}
echo link2 . '<form action="razdel_edit.php?id='.$id.'" method="post" name="form">';
echo '<input name="name" value="'.$razdel['name'].'" type="text" maxlength="50"/><br/ >';
echo '<input name="submit" class="submit" type="submit" value="Изменить" /></form>' . div;