<?

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

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

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