<?

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 ( isset($_POST['submit']) ) {
    
    $name = html( $_POST['name'] );
    $id = html( $_GET['id'] );
    
    if ( empty($name) ) {
        
        header('Location: index.php?mod=empty_add&result=error');
        
    } else {
        
    $result = mysql_query("INSERT INTO `forum_podrazdel` SET `name` = '".$name."', `razdel_id` = '".$id."'");
    
    if ( $result != NULL ) {
        header('Location: index.php?mod=prazdel_add&result=good');
    } else {
        header('Location: index.php?mod=prazdel_add&result=error');
    }        
        
    }
    
}


echo link1 . 'Создание подфорума .: Форум '.$razdel['name'].'' . div;
echo link2 . '<form action="prazdel_add.php?id='.$id.'" method="post" name="form">';
echo '<input name="name" type="text" maxlength="50"/><br/ >';
echo '<input name="submit" class="submit" type="submit" value="Создать" /></form>' . div;