Arkadaşlar Merhaba;
limde bir js dosyam var içinde bir html oluşturup sayfama kopyalıyorum
    $(document).on('click', '#addRows', function() {
        count++;
        var htmlRows = '';
        htmlRows += '<tr>';
        htmlRows += '<td><input class="itemRow" type="checkbox"></td>';          
         htmlRows += ' <td>   <select class="form-control" data-trigger name="productName[]" id="productName_'+count+'"  id="choices-single-groups">';
        htmlRows += '<?php ';  
        htmlRows += '$statement = $pdo->prepare("SELECT * FROM tbl_malzeme WHERE DURUM=1 AND STOKTAKIP=1");';
        htmlRows += '$statement->execute();';
        htmlRows += '$result = $statement->fetchAll(PDO::FETCH_ASSOC);   ';                        
        htmlRows += 'foreach ($result as $stoktakip) {     ?>';
        htmlRows += '<option value="<?php echo $stoktakip[MID] ?>"><?php echo $stoktakip[MADI] ?> </option>';
        htmlRows += '<?php } ?>';
        htmlRows += '</select></td> ';          
    
        htmlRows += '<td><input type="number" name="quantity[]" id="quantity_'+count+'" class="form-control quantity" autocomplete="off" required></td>';          
        htmlRows += '<td><input type="number" name="price[]" id="price_'+count+'" class="form-control price" autocomplete="off" required></td>';        
        htmlRows += '<td><input type="number" name="total[]" id="total_'+count+'" class="form-control total" autocomplete="off" required></td>';          
        htmlRows += '</tr>';
        $('#invoiceItem').append(htmlRows);
    });
bunun içinde php kodları da var. bu htmlRows değişkeni php sayfasına gelirken php tagları yorum satırına donüşüyor.

neden olabilir yada çözüm yolu nedir acaba