My code is as follows:
<div id="maddeContainer">
<!-- İlk Madde Başlığı ve Açıklaması -->
<div class="form-row mt-1">
<div class="form-group col-4 m-0">
<label for="email" class="col-form-label s-12"><i class="icon-envelope-o mr-2"></i>Madde Başlığı</label>
<input name="madde_t[]" placeholder="Madde Başlığı" class="form-control r-0 light s-12" type="text">
</div>
<div class="form-group col-4 m-0">
<label for="roll1" class="col-form-label s-12">Madde Açıklaması</label>
<textarea name="madde_d[]" placeholder="Madde Açıklaması" class="form-control r-0 light s-12" type="text"></textarea>
</div>
<div class="form-group col-2 mt-4 pt-2">
<button class="btn btn-danger" type="button" onclick="deleteMadde()"><i class="icon icon-delete"></i>Satır Sil</button>
</div>
<div class="form-group col-2 mt-4 pt-2">
<button class="btn btn-success" type="button" onclick="addNewMadde()"><i class="icon icon-plus-circle"></i>Yeni Ekle</button>
</div>
</div>
</div>
<script>
let maddeCounter = 1;
function addNewMadde() {
maddeCounter++;
// Yeni Madde Container oluştur
var newMaddeContainer = document.createElement('div');
newMaddeContainer.className = 'form-row mt-1';
// Yeni Madde Başlığı
var newMaddeTitle = document.createElement('div');
newMaddeTitle.className = 'form-group col-4 m-0';
newMaddeTitle.innerHTML = '<label for="email" class="col-form-label s-12"><i class="icon-envelope-o mr-2"></i>Madde Başlığı</label>' +
'<input name="madde_t[]" placeholder="Madde Başlığı" class="form-control r-0 light s-12" type="text">';
// Yeni Madde Açıklaması
var newMaddeDescription = document.createElement('div');
newMaddeDescription.className = 'form-group col-4 m-0';
newMaddeDescription.innerHTML = '<label for="roll1" class="col-form-label s-12">Madde Açıklaması</label>' +
'<textarea name="madde_d[]" placeholder="Madde Açıklaması" class="form-control r-0 light s-12" type="text"></textarea>';
// Yeni Ekle Butonu
var newButtonDelete = document.createElement('div');
newButtonDelete.className = 'form-group col-2 mt-4 pt-2';
newButtonDelete.innerHTML = '<button class="btn btn-danger btn-remove" type="button" onclick="deleteMadde()"><i class="icon icon-delete"></i>Satır Sil</button>';
var newButton = document.createElement('div');
newButton.className = 'form-group col-2 mt-4 pt-2';
newButton.innerHTML = '<button class="btn btn-success" type="button" onclick="addNewMadde()"><i class="icon icon-plus-circle"></i>Yeni Ekle</button>';
// Yeni eklenen alanları, sayfaya ekleyin
newMaddeContainer.appendChild(newMaddeTitle);
newMaddeContainer.appendChild(newMaddeDescription);
newMaddeContainer.appendChild(newButtonDelete);
newMaddeContainer.appendChild(newButton);
document.getElementById("maddeContainer").appendChild(newMaddeContainer);
}
</script>
I duplicated and filled the inputs 3 times, but the data comes like this:
When I print the data I entered into the inputs with the dd command, it gives the following output. The first value in the inputs comes, but the other values do not. I did the same codes in another project, but it works with the same codes.
"madde_t" => array:1 [▼
0 => "dsadsa"
]
"madde_d" => array:1 [▼
0 => "dasdsa"
]
my project is a laravel project.