• 11-02-2023, 12:24:58
    #1
    Merhaba Arkadaşlar
    aşağıdaki kodlamada veritabanındaki frmtype sutunundaki sonuca göre select optionları, input text leri saydıramadım, bu konuda ücretli yardımcı olabilirmisiniz.
    <?php
    require_once "../data.php";
    require_once "../fonksiyon.php";
    $id = $_POST["id"];
    $ozellik = $_POST["ozellik"];
    $dil = $_POST["dil"];
    $sorgukt = $db->prepare("SELECT * FROM ozellikcat WHERE durum=? AND dil=? AND find_in_set(?,kategori) ORDER BY sira ASC");
    $sorgukt->execute(["1", $dil, $id]);
    $OZKATislem = $sorgukt->fetchALL(PDO::FETCH_ASSOC);
    $ozellikler = [];
    foreach (explode(",", $ozellik) as $k => $v){
     $id = explode("-", $v);
     $ozellikler[] = ["id" => $id[0], "value" => explode("|", $id[1])];
    }
    foreach ($OZKATislem as $sonuckat){
    ?>
    <div class="form-group row mb-2">
     <div class="col-lg-3 bg-arac text-right">
     <label class="col-form-label mb-0" for=""><?=$sonuckat["adi"];?></label>
     </div>
     <div class="col-lg-9">
     <div class="row">
     <?php
        $sorguoze = $db->prepare("SELECT * FROM ozellik WHERE durum=? AND dil=? AND kategori=? ORDER BY id DESC");
        $sorguoze->execute(["1", $dil, $sonuckat["id"]]);
        $islemoze = $sorguoze->fetchALL(PDO::FETCH_ASSOC);
        $ozdahiller = explode(",", $ozellik);
        foreach ($islemoze as $sonucoze){
        $ozellikK = array_search($sonucoze["kategori"], array_column($ozellikler, "id"));
        $ozellikid = $varyantK !== false ? array_search($sonucoze["id"], $ozellikler[$ozellikK]["value"]) : false;
     ?>
     <div class="col-lg-4">
     <div class="form-check form-check-primary">
     <label class="form-check-label">
     <?php if($sonucoze["frmtype"]== "select"){?>
     burası select tir
     <?}?>
     <?php if($sonucoze["frmtype"]== "text"){?>
     burası text tir
     <?}?>
     <?php if($sonucoze["frmtype"]== "checkbox"){?>
     burası checkbox tur
     <?}?>
     <input name="ozellik[]" type="checkbox" class="form-check-input" value="<?=$sonucoze["kategori"];?>-<?=$sonucoze["id"];?>" <?php if ($ozellikid !== false){echo "checked";}?>> <i class="input-helper"></i> <?=$sonucoze["adi"];?></label>
     </div>
     </div>
     <?
        }
     ?>
     </div>
     </div>
    </div>
    <?
       }
    ?>
  • 12-02-2023, 22:21:23
    #2
    Arkadaşlar bu konuda bilgisi olan yokmu