Postingan lainnya
tidak bisa simpan data di database padahal tidak ada pesan error ,dan di code nya aman aman aja
arsip.php
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Arsip Balai Teknik Rawa</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Data Arsip</h2> <a href="index.php?page=tambah_arsip_masuk" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> Tambah Arsip</a><a href="index.php?page=tambah_arsip_masuk" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> CETAK EXCEL</a>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<table id="arsip" class="table table-striped table-bordered table-hover">
<thead>
<tr style="font-size: 13px;">
<th width="1" style="vertical-align: middle;">No</th>
<th><center>Kode Klasifikasi</center></th>
<th><center>Uraian Informasi</th>
<th style="vertical-align: middle;"><center>Keterangan</center></th>
<th><center>Jumlah,<br> Tanggal Dokumen</center></th>
<th style="vertical-align: middle;"><center>Action</center></th>
</tr>
</thead>
<tbody>
<tr>
<?php
$no=1;
$query = "SELECT * FROM arsip_masuk";
$sql = mysqli_query($connect, $query);
while ($data= mysqli_fetch_array($sql)){
?>
<td width="1" style="vertical-align: middle;"><?php echo $no++; ?></td>
<td style="vertical-align: middle;"><?php echo $data['primer'] ?>.<?php echo $data['sekunder'] ?>.<?php echo $data['tersier'] ?>,<br> </td>
<td style="vertical-align: middle;"><?php echo $data['isi_ringkas'] ?><br> <b>FILE :</b>
<a href="upload/arsip_masuk/<?php echo $data['file']?>" class="btn btn-default btn-xs fa fa-download"> <?php echo $data['file'];?></a>
</td>
<td style="vertical-align: middle;"><?php echo $data['keterangan'] ?></td>
<td style="vertical-align: middle;"><?php echo $data ['jumlah'] ?>,<br><?php echo IndonesiaTgl($data['tanggal_dok']) ?></td>
<td>
<center>
<a href="index.php?page=edit_surat_masuk&id=<?php echo $data['id']; ?>" class="btn btn-warning" title="Edit"><i class="fa fa-pencil-square-o"></i></a>
<a href="index.php?page=hapus_surat_masuk&id=<?php echo $data['id'] ?>" class="btn btn-danger" title="Hapus"><i class="fa fa-trash-o"></i></a>
<?php if($_SESSION['level']== 'admin') {?>
<a href="cetak_disposisi.php?id=<?php echo $data['id']; ?>" class="btn btn-success" title="Print" type="submit" target="_blank" name="cetak"><i class="fa fa-print"></i></a>
<?php } ?>
</center>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
tambah_arsip_masuk.php
<?php
if (isset($_REQUEST['submit'])) {
$primer = $_POST['primer'];
$sekunder = $_POST['sekunder'];
$tersier = $_POST['tersier'];
$isi_ringkas = $_POST['isi_ringkas'];
$keterangan = $_POST['keterangan'];
$tanggal_dok = InggrisTgl($_POST['tanggal_dok']);
$jumlah = $_POST['jumlah'];
$user = $_SESSION['fullname'];
$file = $_FILES['file']['name'];
$tmp = $_FILES['file']['tmp_name'];
$path = "upload/arsip/".$file;
if (move_uploaded_file($tmp, $path)) {
$insert = mysqli_query($koneksi,"INSERT INTO arsip_masuk(primer,sekunder,tersier,isi_ringkas,keterangan,tanggal_dok,jumlah,NOW(),file,user VALUES('','$primer','$sekunder','$tersier', '$isi_ringkas', '$keterangan', '$tanggal_dok', '$jumlah' ,NOW(), '$file', '$user')");
$sql = mysqli_query($connect, $query);
if($insert){
echo 'data berhasil disimpan';
}else{
echo 'data belum disimpan';
}
}
}
?>
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Tambah Arsip Baru</h3>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Form Tambah Arsip</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<!--Form Tambah Arsip -->
<form class="form-horizontal form-label-left" method="post" enctype="multipart/form-data">
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Kode Klasifikasi<span class="required"> :</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<select class="form-control col-md-7 col-xs-12" name="primer" required="required">
<option>HK</option>
<option>HL</option>
<option>HM</option>
</select>
<select class="form-control col-md-7 col-xs-12" name="sekunder" required="required">
<option>00</option>
<option>01</option>
<option>02</option>
</select>
<select class="form-control col-md-7 col-xs-12" name="tersier" required="required">
<option>00</option>
<option>01</option>
<option>02</option>
</select>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Uraian Informasi<span class="required"> :</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<textarea name="isi_ringkas" class="form-control col-md-7 col-xs-12" required="required"></textarea> </div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Keterangan<span class="required"> :</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" name="keterangan" class="form-control col-md-7 col-xs-12" required="required">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Tanggal Dokumen<span class="required"> :</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" name="tanggal_dok" class="form-control has-feedback-left" id="tanggal">
<span class="fa fa-calendar-o form-control-feedback left" aria-hidden="true"></span>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Jumlah<span class="required"> :</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" name="jumlah" class="form-control col-md-7 col-xs-12" required="required">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">File<span class="optional"> :</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="file" name="file" class="form-control col-md-7 col-xs-12" optional="optional">
</div>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-6 col-md-offset-3">
<button type="reset" class="btn btn-default">Reset</button>
<input type="submit" class="btn btn-success" value="Simpan" name="submit">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
koneksi.php
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
$dbname = "sias";
//koneksi
$connect = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
//cek
if(mysqli_connect_errno()){
echo 'Koneksi gagal :' .mysqli_connect_errno();
}
?>
0
Tanggapan
Koneksi database anda disimpan di $connect atau $koneksi? Kenapa tidak konsisten?
oh iya udah diganti bang jadi $connect tapi tetep gak bisa
2 Jawaban:
<div>Karena dari awal tidak ada variabel $koneksi di kodingan mu.. dan juga dibagian situ $query nya juga dipakaikan yg mana</div>
1
Tanggapan
mohon maaf bang jadi seharusnya bagaimana ya? maaf bang baru belajar
<div>coba pas kirim data di print dulu, data nya ada ga?</div>
0