Web Analytics Made Easy -
StatCounter Css is not working - CodingForum

Announcement

Collapse
No announcement yet.

Css is not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Css is not working

    I am trying to write a simple script .I have a css file

    And I am sure the stylesheet is properly imported because the rest of the code works except this part


    .populer{
    border:1px solid #ddd;
    width: 230px;

    }



    this is the rest of code


    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
        <title>kolay video dersleri</title>
        <link rel="stylesheet" href="style.css"/>
        <link rel="stylesheet" href="styles.css">
        <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
        <script src="script.js"></script>
    </head>
    <body>
    
    <div id='cssmenu'>
        <ul>
            <li class='active'><a href='index.php'><span>anasayfa</span></a></li>
            <li><a href='#'><span>hakkimda</span></a></li>
            <li><a href='#'><span>iletisim</span></a></li>
            <li class='last'><a href='#'><span>dersler</span></a></li>
        </ul>
    </div>
    <div class="ara">
        <form action="index.php?islem=ara" method="post">
            <input type="text" name="ara"/>
            <button type="submit">ara</button>
        </form>
    </div>
    
    
    </body>
    </html>
    <?php
    try {
    
        $db = new PDO("mysql:host=localhost;dbname=blog;charset=utf8", "root", "");
    
    } catch (PDOException $mesaj) {
    
    
        echo $mesaj->getmessage();
    
    }
    
    $islem = @$_GET["islem"];
    
    switch ($islem) {
    
        case "ara":
    
            if ($_POST) {
    
                $ara = $_POST["ara"];
    
                if (!$ara) {
                    echo "lutfen bos bırakmayın";
                } else {
                    $v = $db->prepare("select * from konular  where konu_baslik regexp ? order by konu_id desc");
                    $v->execute(array($ara));
                    $x = $v->fetchAll(PDO::FETCH_ASSOC);
                    $xx = $v->rowCount();
                    if ($xx) {
                        echo "<div style='font-size:22px;color:green;position:relative; left:400px;'>aramanızla ilgili " . $xx . " sonuc bulundu</div>";
                        foreach ($x as $m) {
                            ?>
                            <div class="konu">
                                <h3><?php echo $m["konu_baslik"]; ?></h3>
                                <h5>ekleyen : <?php echo $m["konu_ekleyen"]; ?>
                                    <span>tarih : <?php echo $m["konu_tarih"]; ?></h5>
                                <p><?php echo substr($m["konu_aciklama"], 0, 200); ?></p>
                                <div class="x"><a href="index.php?islem=devam&id=<?php echo $m["konu_id"]; ?>">devamı</a>
                                </div>
                            </div>
                            <?php
                        }
                    } else {
                        echo "<div style='font-size:22px;color:red;position:relative; left:400px;'>hiç sonuc bulunamadı</div>";
                    }
                }
            }
    
            break;
        case "devam":
            $id = @$_GET["id"];
            $v = $db->prepare("select * from konular where konu_id=?");
            $v->execute(array($id));
            $x = $v->fetchAll(PDO::FETCH_ASSOC);
            $xx = $v->rowCount();
            if ($xx) {
                foreach ($x as $m) {
                    ?>
                    <div class="devam">
                        <h3><?php echo $m["konu_baslik"]; ?></h3>
                        <h5>ekleyen : <?php echo $m["konu_ekleyen"]; ?> <span>tarih : <?php echo $m["konu_tarih"]; ?></span>
                        </h5>
                        <p><?php echo $m["konu_aciklama"]; ?></p>
                    </div>
                    <?php
                }
    
                // konu hit baslangıc
                if ([email protected]$_COOKIE["hit" . $id]) {
                    $hit = $db->prepare("update konular set konu_hit= konu_hit +1 where konu_id=?");
                    $hit->execute(array($id));
    
                    setcookie("hit" . $id, "_", time() + 9898989898);
                }
                // konu hit bitis
    
    
                // yorumları listele
    
                $c = $db->prepare("select * from yorumlar where yorum_konu_id=?");
    
                $c->execute(array($id));
    
                $x = $c->fetchAll();
                $xx = $c->rowCount();
    
                if ($xx) {
    
                    echo "<div class='w'>bu konuya (" . $xx . ") yorum yazılmıs</div>";
                    foreach ($x as $b) {
    
    
                        ?>
    
                        <div class="yorum">
                            <h4> ekleyen : <?php echo $b["yorum_ekleyen"]; ?> <span>tarih : <?php echo $b["yorum_tarih"]; ?>
                            </h4>
                            <p><?php echo $b["yorum_mesaj"]; ?></p>
                        </div>
    
                        <?php
    
                    }
    
    
                } else {
    
                    echo "<div class='mesajiniz'>bu konuya hic yorum yazılmamıs ilk yazan sen ol</div>";
    
                }
    
    
                // yorumları listele bitisi
    
                // yorumları ekleyelim
                if ($_POST) {
    
                    $isim = $_POST["isim"];
                    $eposta = $_POST["eposta"];
                    $mesaj = $_POST["mesaj"];
                    $konuid = $_POST["konuid"];
    
                    if (!$isim || !$eposta || !$mesaj) {
    
                        echo "gerekli alanları doldurmanız gerekiyor";
    
                    } else {
                        $c = $db->prepare("insert into yorumlar set 
    			  
    			                 yorum_ekleyen=?,
    							 yorum_eposta=?,
    			                 yorum_mesaj=?,
                                 yorum_konu_id=? 							 
    			  
    			  ");
    
                        $x = $c->execute(array($isim, $eposta, $mesaj, $konuid));
    
    
                        if ($x) {
    
    
                            echo "<div class='mesajiniz'>mesajınız basarılı bir sekilde gonderilmistir yonlendiriliyorsunuz</div>";
                            $url = $_SERVER['HTTP_REFERER'];  // hangi sayfadan gelindigi degerini verir.
    
                            header("refresh: 2; url=" . $url . "");
    
                        } else {
    
                            echo "yorum gonderirken bir hata olustu";
    
                        }
    
                    }
                } else {
    
                    ?>
                    <div class="yorumlar">
                        <h2>yorum gonder</h2>
                        <form action="" method="post">
                            <table cellpadding="5" cellspacing="5">
                                <tr>
                                    <td>isim</td>
                                    <td><input type="text" name="isim"/></td>
                                </tr>
                                <tr>
                                    <td>eposta</td>
                                    <td><input type="text" name="eposta"/></td>
                                </tr>
                                <tr>
                                    <td>mesaj</td>
                                    <td><textarea name="mesaj" id="" cols="50" rows="10"></textarea></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td><input type="hidden" name="konuid" value="<?php echo $m["konu_id"]; ?>"/></td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit">mesaj gonder</button>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
    
                    <?php
    
    
                }
                // yorum ekleme bitisi
    
    
            } else {
                echo "boyle bir konu yok silinmis yada hiç var olmamıs olabilir";
            }
    
    
            break;
    
        case "iletisim":
            echo "burası iletisim";
            break;
    
        case "hakkimda":
            echo "hakkimda";
            break;
    
        default:
            // sayfalama
            $pop = $db->prepare("select * from konular ORDER  BY konu_hit DESC limit 5");
            $pop->execute(array());
            $v = $pop->fetchAll();
    
            foreach ($v as $x) {
    
                ?>
    
                <div class="populer">
                    <?php echo   $x["konu_baslik"];?>
                </div>
                <?php
            }
    
            $sayfa = intval(@$_GET["sayfa"]);
            if (!$sayfa) {
                $sayfa = 1;
            }
            $v = $db->prepare("select * from konular");
            $v->execute(array());
            $toplam = $v->rowCount();
            $limit = 2;
            $goster = $sayfa * $limit - $limit;
            $sayfa_sayisi = ceil($toplam / $limit);
            $forlimit = 2;
    
            // sayfalama bitis
    
    
            $v = $db->query("select * from konular  order by konu_id desc limit $goster,$limit");
    
            $v->execute(array());
            $x = $v->fetchAll(PDO::FETCH_ASSOC);
    
            foreach ($x as $m) {
    
                // konuya ait yorum sayısını bul
    
                $v = $db->prepare("select * from yorumlar where yorum_konu_id=?");
                $v->execute(array($m["konu_id"]));
                $zban = $v->rowCount();
    
    
                ?>
    
                <div class="konu">
                    <h3><?php echo $m["konu_baslik"]; ?></h3>
                    <h5>ekleyen : <?php echo $m["konu_ekleyen"]; ?> yorum : (<?php echo $zban; ?>) goruntulenme
                        : <?php echo $m["konu_hit"]; ?><span>tarih : <?php echo $m["konu_tarih"]; ?></span></h5>
                    <p><?php echo substr($m["konu_aciklama"], 0, 200); ?>....</p>
                    <div class="x"><a href="index.php?islem=devam&id=<?php echo $m["konu_id"]; ?>">devamı</a></div>
                </div>
                <?php
            }
    
            // sayfalam linkleri
    
            for ($i = $sayfa - $forlimit; $i < $sayfa + $forlimit + 1; $i++) {
    
                if ($i > 0 && $i <= $sayfa_sayisi) {
    
                    if ($i == $sayfa) {
                        echo "<span class='aktif'>" . $i . "</span>";
                    } else {
    
                        echo "<span class='sayfa'><a href='index.php?sayfa=" . $i . "'>" . $i . "</a></span>";
                    }
                }
            }
            if ($sayfa != $sayfa_sayisi) {
                echo "<span class='sayfa'><a href='index.php?sayfa=" . $sayfa_sayisi . "'>son</a></span>";
            }
            break;
    
    
    }
    
    
    ?>
    What am id doing wrong ?(sorry for my poor english)

  • #2
    You are outputting invalid HTML - that PHP is writing content after the </html> tag which should be the end of the page.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

    Comment


    • #3
      It's also a HORRIFYINGLY BAD IDEA to do a fetch_all, since you just doubled the memory footprint and wasted a bunch of CPU time making a copy of your result set for nothing.

      But yeah, closing the body and html tags while still outputting content? that's your most likely problem as it's just outputting invalid code from that point on... though invalid markup seems to be the order of the day in what you have there, since how can you have a H5 without a H4 for it to be the start of a subsection of -- much less what makes that text the start of a new subsection if there's a H3 before it every time.

      Lemme guess, are you choosing your HTML based on what the tags look like and not what they MEAN? Oh what am I saying, you're using a tranny document type, of course you are. Say hello to the bleeding edge of 1997 development practices.

      You might also have an easier time of things if you flipped your double and single quote usage on your echos, and stopped doing string addition when unneccessary in favor of comma delimits. You've got a few if statements i'd be axing in favor of ternary operators whilst at it too and a LOT of redundant code... and that section of endlessly and pointlessly opening and closing PHP for no good reason? OUCH.

      Also very much doubt you have a legitimate reason for the DIV around the menu or div around the form, since FORM and UL are perfectly good block-level containers in their own right... and really loading scripts in the head probably isn't that great an idea ever -- but your using the bloated train wreck of ineptitude known as jQuery so...

      Oh, and if you're using @ to suppress PHP errors, you're doing something horrifyingly and terrifyingly wrong... and $_POST always exists if it has values or not...

      Not a whole lot of anything in that code makes a lick of sense, and what little does is horribly out of date and/or a bad idea to begin with.
      Last edited by deathshadow; Sep 17, 2016, 05:52 PM.
      Walk the dark path, sleep with angels, call the past for help.
      https://cutcodedown.com
      https://medium.com/@deathshadow

      Comment


      • #4
        Originally posted by deathshadow View Post
        Say hello to the bleeding edge of 1997 development practices.
        You need to be more specific - bleeding edge for January 1997 - it was all declared to be obsolete in December 1997.
        Stephen
        Learn Modern JavaScript - http://javascriptexample.net/
        Helping others to solve their computer problem at http://www.felgall.com/

        Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

        Comment

        Working...
        X