Postingan lainnya
Menampilkan value di form edit menggunakan php native
Assalamualaikum mohon bantuannya master, masalahnya values di setiap form ga muncul
<?php
include '../template/header.php';
// $sql = mysql_query("SELECT * FROM tbl_kategori_event");
?>
<div class="col-md-12">
<div class="portlet box green">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i> Edit Event Activity</div>
<div class="tools">
<a href="" class="collapse"> </a>
<a href="#portlet-config" data-toggle="modal" class="config"> </a>
<a href="" class="reload"> </a>
<a href="" class="remove"> </a>
</div>
</div>
<?php
include"../database/koneksi.php";
$id_event = (int) $_GET['id_event'];
$sql = "select * from tbl_event p inner join tbl_kategori_event b on p.id_event=b.id_kategori where p.id_event='$id_event'";
$result = mysql_query($sql);
$data = mysql_fetch_assoc($result);
?>
<div class="portlet-body form">
<form action="../proses/edit_event.php?id_event=<?= $data['id_event'] ?>" method="POST" enctype="multipart/form-data" class="form-horizontal" role="form">
<div class="form-body">
<div class="form-group">
<label class="col-md-2 control-label">Nama Event</label>
<div class="col-md-6">
<select class="form-control input-lg" name="id_kategori">
<option value="">Pilih Nama Kategori Event</option>
<?php
while ($data = mysql_fetch_assoc($data)) { ?>
<option value="<?=$data['id_kategori'] ?>"><?=$data['nama_kategori'] ?></option>
<?php }
?>
</select>
<span class="help-block"></span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Program</label>
<div class="col-md-6">
<textarea class="form-control input-lg" type="text" name="program" value="<?= $data['program'] ?>" rows="3"></textarea></div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Deliverable</label>
<div class="col-md-6">
<textarea class="form-control input-lg" type="text" name="deliverable" value="<?= $data['deliverable'] ?>" rows="3"></textarea></div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Target</label>
<div class="col-md-6">
<input type="text" name="target" value="<?= $data['target'] ?>" class="form-control input-lg" placeholder="target"> </div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Realisasi</label>
<div class="col-md-6">
<input type="text" name="realisasi" value="<?= $data['realisasi'] ?>" class="form-control input-lg" placeholder="Realisasi"> </div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Prestasi</label>
<div class="col-md-6">
<input type="text" name="prestasi" value="<?= $data['prestasi'] ?>" class="form-control input-lg" placeholder="Prestasi"> </div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Progres Status</label>
<div class="col-md-6">
<select class="form-control input-lg" name="progres_status" value="<?= $data['progres_status'] ?>">
<option value="">Pilih Progres Status</option>
<option value="On Progres">On Progres</option>
<option value="Close"> Close</option>
</select>
</div>
</div>
</div>
<div class="form-actions right1">
<a href="data_program.php" type="button" class="btn red">Batal</a>
<button type="submit" class="btn green">Simpan</button>
</div>
</form>
</div>
</div>
</div>
<?php
include '../template/footer.php';
?>
0
3 Jawaban:
<pre> <?php // Coba print dulu si variable datanya print_r($data); // kalo ada, liet strukturnya apakah harus di foreach/while terlebih dahulu atau bisa langsung di panggil </pre>
1
Tanggapan
Solved gan trima kasih atas responnya
Tanggapan
Solved gan trima kasih atas responnya
untuk textarea bukan pake value, tapi menggunakan berikut: <pre> <textarea><?= $data['program'] ?></textarea> </pre>
2
Tanggapan
Solved gan trima kasih atas responnya