Şimdi Ara

Öğeler istediğim gibi sıralanmadı

Bu Konudaki Kullanıcılar:
2 Misafir - 2 Masaüstü
5 sn
3
Cevap
0
Favori
63
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Merhaba,

    arkadaşlar verileri veritabanından çekerek test gibi bir şey yapmak istiyorum.

    Kodlar şu şekilde :

    <?php
    $testad = filter_input(INPUT_GET, "test");

    $testcek = $baglanti -> prepare("select * from test where baslik = ?");
    $testcek -> bindParam(1, $testad);
    $testcek -> execute();

    $i = 0;

    ?>

    <div id="testler">

    <?php

    foreach ($testcek as $testbilgi) {

    $i++;

    $taciklama = $testbilgi["testaciklama"];
    $c1 = $testbilgi["cevap1"];
    $c2 = $testbilgi["cevap2"];
    $c3 = $testbilgi["cevap3"];
    $c4 = $testbilgi["cevap4"];
    $dogrucevap = $testbilgi["cevap"];

    $formad = "form".$i;

    $radioname = "radio".$i;

    $cradioa = "ra".$i;
    $cradiob = "rb".$i;
    $cradioc = "rc".$i;
    $cradiod = "rd".$i;

    $aciklamatop = 1 * $i;

    $atop = 150 * $i;
    $btop = 200 * $i;
    $ctop = 250 * $i;
    $dtop = 300 * $i;

    ?>
    <label style="position: absolute;top: <?php echo($aciklamatop); ?> px;left: px;"><?php echo($taciklama); ?></label>

    <label style="position: absolute;top: <?php echo($atop); ?> px;left: px;">a) <?php echo($c1); ?></label>

    <label style="position: absolute;top: <?php echo($btop); ?> px;left: px;">b) <?php echo($c2); ?></label>

    <label style="position: absolute;top: <?php echo($ctop); ?> px;left: px;">c) <?php echo($c3); ?></label>

    <label style="position: absolute;top: <?php echo($dtop); ?> px;left: px;">d) <?php echo($c4); ?></label>

    <form action="" method="post" name="<?php echo($formad); ?>">

    <input type="radio" class="<?php echo($cradioa); ?>" name="<?php echo($radioname); ?>" value="a">
    <input type="radio" class="<?php echo($cradiob); ?>" name="<?php echo($radioname); ?>" value="b">
    <input type="radio" class="<?php echo($cradioc); ?>" name="<?php echo($radioname); ?>" value="c">
    <input type="radio" class="<?php echo($cradiod); ?>" name="<?php echo($radioname); ?>" value="d">
    <input type="submit" class="gonderb<?php echo($i); ?>" name="gonder<?php echo($i); ?>" value="Gönder">

    </form>

    <?php

    if (isset($_POST["gonder<?php echo($i); ?>"])) {

    $seciliradio = filter_input(INPUT_POST, $radioname);

    if ($seciliradio == $dogrucevap) {
    echo "Doğru cevap";
    }else{
    echo "Yanlış cevap";
    }

    }

    }

    ?>

    </div>

    <style type="text/css">

    #testler{
    position: absolute;
    top: 225px;
    left: 25px;
    }

    </style>


    Aslında kodda php kodu daha çok :) ama bizi öğelerin yerleştirilmesi ilgilendirdiği için bizi numaralar ve i değişkeni ilgilendiriyor. O da her döngü çalıştığında çalışıyor.

    Öğeler şöyle oluyor :



    Arkadaşlar normalde böyle görünmemesi lazım. Onlara top değeri verdim :

    $atop = 150 * $i;
    $btop = 200 * $i;
    $ctop = 250 * $i;
    $dtop = 300 * $i;


    Normalde şıkların alt alta görünmesini istiyorum.

    Bu sorunu nasıl çözebilirim?

    Yardımınıza ihtiyacım var.







  • sen tam olarak ne istiyorsun hacım. biraz daha detaylı açıkla

    < Bu ileti DH mobil uygulamasından atıldı >
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.