if (mund_te_postoje()) {
    echo "<div id=\"postobtn\">Posto dicka te re</div>";
    if (mund_te_shpalle()) {
        echo "<div id=\"postobtn_shp\">Posto nje Shpallje</div>";
    }
    echo "<div id=\"formular\">";
    echo "<form id=\"formoid\" name=\"postim\" action=\"postim.php?" . url_vendndodhja() . "\" method=\"post\">";
    echo "<input name=\"titull\" type=\"text\" placeholder=\"Titulli\"></input></br>";
    echo "<textarea name=\"text\" rows=\"5\" cols=\"50\" placeholder=\"Teksti\"></textarea>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Posto\"></input>";
    echo "</form>";
    echo "</div>";
}
if (mund_te_shpalle()) {
    echo "<div id=\"formular_shp\">";
    echo "<form id=\"formoid\" name=\"postim\" action=\"postim.php?" . url_vendndodhja() . "&shpallje=1\" method=\"post\">";
    echo "<input name=\"titull\" type=\"text\" placeholder=\"Titulli\"></input></br>";
    echo "<textarea name=\"text\" rows=\"5\" cols=\"50\" placeholder=\"Teksti\"></textarea>";
    echo "<input type=\"submit\" name=\"Submit\" value=\"Posto\"></input>";
    echo "</form>";
    echo "</div>";
}
if (isset($sel_uni) || isset($sel_fak) || isset($sel_dega)) {
    echo "<div id=\"viza\"><div class=\"nentitull\">Postime te meparshme</div><br/></div>";
    $sql = "SELECT * FROM\n\t\t\t\t\t\t\t\t\t`rrjet_social_db`.`postim`\n\t\t\t\t\t\t\t\t\tINNER JOIN `rrjet_social_db`.`user` \n\t\t\t\t\t\t\t\t\tON (`postim`.`postim_id_user` = `user`.`id_user`) WHERE ";
    if (isset($sel_uni)) {
        $sql .= "postim_id_uni = {$sel_uni['id_uni']} ";
    } elseif (isset($sel_fak)) {
        $sql .= "postim_id_fak = {$sel_fak['id_fak']} ";
    } else {
        $sql .= "postim_id_dega = {$sel_dega['id_dega']} ";
<?php 
$id_vendndodhje;
$titull = jo_bosh($_POST['titull']) ? mysql_pregatit($_POST['titull']) : "Pa titull";
$text = mysql_pregatit($_POST['text']);
$date = date("Y-m-d H:i:s");
$id_user = $_SESSION['id'];
if (jo_bosh($text)) {
    $sql = "INSERT INTO postim (postim_titull, postim_text, postim_date, postim_id_user, tipi, ";
    if (isset($sel_uni)) {
        $sql .= "postim_id_uni) ";
        $id_vendndodhje = $sel_uni['id_uni'];
    } elseif (isset($sel_fak)) {
        $sql .= "postim_id_fak) ";
        $id_vendndodhje = $sel_fak['id_fak'];
    } else {
        $sql .= "postim_id_dega) ";
        $id_vendndodhje = $sel_dega['id_dega'];
    }
    if (isset($_GET['shpallje'])) {
        $sql .= "VALUES ( '{$titull}', '{$text}', '{$date}', '{$id_user}', 1, '{$id_vendndodhje}')";
    } else {
        $sql .= "VALUES ( '{$titull}', '{$text}', '{$date}', '{$id_user}', 0, '{$id_vendndodhje}')";
    }
    echo $sql;
    $rezultati = mysqli_query($connection, $sql);
    $redirect = "location:index.php?" . url_vendndodhja();
    header($redirect);
} else {
    $redirect = "location:index.php?" . url_vendndodhja();
    header($redirect);
}