i'm trying to insert bootraps modal to form POST but doesn't work . whenever I tried with modal, the result from post is always wrong . for example, the result from my query in row one is abcde, row two is fghij. Without boostrap modal the result is right, but with bootsrap modal is always show only from row one ..
here my working code without modal that working perfectly
<?php $no=1; foreach ($result2 as $row) {
if ($row->status_vld == 0){
$valid = 'Belum Valid'; }
else {
$valid = 'sudah valid';}
echo '<tr>';
echo '<td>'.$no++.'</td>';
echo '<td>'.$row->nama_tabel.' ';
echo
'<form action="validasi_mahasiswa" method="POST" role="form" class="form-horizontal">
<div class="form-group">
<input type="hidden" class="form-control" id="valid" name="validasi" value='.$row->nama_tabel.'>
</div>
<button type="submit" class="btn btn-primary">VALIDASI</button>
</form>
</td>';
echo '<td>'.$row->pt_upload.'</td>';
echo '<td>'.$row->id_pt.'</td>';
echo '<td>'.$row->tgl_upload.'</td>';
echo '<td>'.$valid.'</td>';
echo '</tr>';
}
?>
and here with bootsrap modal that doesn't work
echo '
<form action="validasi_mahasiswa" method="POST" role="form" class="form-horizontal">
<input type="hidden" class="form-control" id="valid" name="validasi" value='.$row->nama_tabel.'>
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="form-group">
<button type="submit" class="btn btn-primary">VALIDASI</button>
</div>
</div>
</div>
</div>
</div>
</form>
</td>';
in bootstrap model its not work,use jquery
$('.load-modal').on('click', function(e){
e.preventDefault();
var url = $(this).attr('attr');
$.ajax({
url: url,
type: 'post',
async: false,
success: function(response){
$('#ajax-response').html(response);
$('#myModal').modal('show');
}
})
})