1. sayfa
<?phpinclude "baglanti.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"><?phpforeach ($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 = -20 * $i; $atop = 150 * $i; $btop = 200 * $i; $ctop = 250 * $i; $dtop = 300 * $i; ?> <br> <label style="position: absolute;top: <?php echo($aciklamatop); ?> px;left: px;"><?php echo($taciklama); ?></label><br><br> <label style="position: absolute;top: <?php echo($atop); ?> px;left: px;">a) <?php echo($c1); ?></label><br> <label style="position: absolute;top: <?php echo($btop); ?> px;left: px;">b) <?php echo($c2); ?></label><br> <label style="position: absolute;top: <?php echo($ctop); ?> px;left: px;">c) <?php echo($c3); ?></label><br> <label style="position: absolute;top: <?php echo($dtop); ?> px;left: px;">d) <?php echo($c4); ?></label><br><br> <form action="" method="post" name="<?php echo($formad); ?>"> <input type="radio" class="<?php echo($cradioa); ?>" name="<?php echo($radioname); ?>" value="a">a <input type="radio" class="<?php echo($cradiob); ?>" name="<?php echo($radioname); ?>" value="b">b <input type="radio" class="<?php echo($cradioc); ?>" name="<?php echo($radioname); ?>" value="c">c <input type="radio" class="<?php echo($cradiod); ?>" name="<?php echo($radioname); ?>" value="d">d <input type="submit" id="gonderb" class="gonderb<?php echo($i); ?>" name="g" value="Gönder"> </form> <?php} if (isset($_POST["g"])) { ?> <script type="text/javascript"> alert("veri alındı"); </script> <?php $seciliradio = filter_input(INPUT_POST, $radioname); if ($seciliradio == $dogrucevap) { echo "Doğru cevap yazılımcı parası eklenmiştir"; ?> <script type="text/javascript"> document.getElementById("gonderb").remove(); alert("a"); </script> <?php }else{ echo "Yanlış cevap"; } }?></div>
arkadaşlar test sayfası için, foreach kullanarak post almaya çalıştım ama olmadı.
Kod kısmı şöyle :
Hiç bir alert almıyorum hiç mesaj yok.
Bu sorunu nasıl çözebilirim?
Yardımınıza ihtiyacım var.
< Bu ileti DH mobil uygulamasından atıldı >