Postingan lainnya
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
Bagaimana saya bisa menampilkan modal dari hasil aksi berikut ?
$g=$_GET['sender'];
if($g=='data_form')
{
$sql="INSERT INTO data_form (data_1, data_2, data_3, data_4, data_5, data_6, data_7, data_8, data_9, data_10, data_11, data_12)
VALUES
('$_POST[data_1]',
'$_POST[data_2]',
'$_POST[data_3]',
'$_POST[data_4]',
'$_POST[data_5]',
'$_POST[data_6]',
'$_POST[data_7]',
'$_POST[data_8]',
'$_POST[data_9]',
'$_POST[data_10]',
'$_POST[data_11]',
'$_POST[data_12]')";
if (mysqli_query($config, $sql)) {
$last_id = mysqli_insert_id($config);
echo '<script>
Swal.fire({
title: "Terimakasih ('.$_POST[data_1].') !",
text: "Data anda berhasil disimpan!",
icon: "success",
buttonsStyling: false,
confirmButtonText: "Confirm me!",
customClass: {
confirmButton: "btn btn-primary"
}
}).then((value) => {
window.location.href = "index.php";
})
</script>';
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($config);
}
\\\* MODAL ***
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalSizeLg" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="add"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i aria-hidden="true" class="ki ki-close"></i>
</button>
</div>
<div class="modal-body">
<table class="table table-borderless">
<?php
$no = 1;
$data = mysqli_query($config,"SELECT * FROM data_form WHERE id IN (SELECT MAX(id) FROM data_form)");
while($row = mysqli_fetch_array($data)){
?>
<tr>
<th> Data 1:</th>
<td> <?php echo $row['data_1'];?> </td>
</tr>
<tr>
<th> Data 2:</th>
<td> <?php echo $row['data_2'];?> </td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</div>
</div>
0
Tanggapan
jangan hanya copt paste kode, perjelas bagian mana yang kamu tanyakan ya di forum
1 Jawaban:
<div>Don't Know LOL. try searching your whole "Code" in GOOGLE. ha ha ha</div>
0