hi guys i got some errors in my code first how to get another table to edit my post i can show the value but just value the list of table of selection is not showing second problem is i cant show my event name
this my problem
this my event name i cant show it from the value
public function getEditPost($id)
{
$query = "SELECT * FROM `postfes`
JOIN `daerah` ON `postfes`.`daerah_id` = `daerah`.`id_daerah`
JOIN `user` ON `postfes`.`email_id` = `user`.`id`
WHERE `id_post` = '" . $id . "' AND `email_id` = '" . $_SESSION['id'] . "' ";
return $this->db->query($query)->result_array();
return $this->db->get_where('postfes', ['id_post' => $id])->result_array();
}
this my model
public function editPost($id)
{
$data['title'] = 'Edit Post';
$data['user'] = $this->db->get_where('user', ['email' => $this->session->userdata('email')])->row_array();
$data['daerah'] = $this->db->get_where('daerah', ['nm_daerah' => $this->session->userdata('nm_daerah')])->row_array();
$this->load->model('PostModel', 'post');
$data['postfes'] = $this->post->getEditPost($id);
if ($this->form_validation->run() == false) {
$this->load->view('templates/user-header', $data);
$this->load->view('templates/user-sidebar', $data);
$this->load->view('templates/user-topbar', $data);
$this->load->view('user/editPost', $data);
$this->load->view('templates/user-footer');
} else {
}
}
this my controller
and this my view code
thanks for your attention sorry for my english
<h1 class="h3 mb-0 text-gray-800"><?= $title; ?></h1>
<div class="row">
<div class="col-lg">
<?php echo form_open_multipart('user/editPost'); ?>
<div class="modal-body">
<div class="form-group">
<input type="text" class="form-control" id="namaFes"
name="namaFes" value="<?= $postfes['namaFes']; ?>" placeholder="Nama
Festival">
</div>
<div class="form-group">
<select name="daerah_id" id="daerah_id" class="form-control">
<?php foreach ($postfes as $nm) : ?>
<option value="<?= $nm['id_daerah']; ?>"><?=
$nm['nm_daerah']; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<input type="date" class="form-control" id="tanggal"
name="tanggal" placeholder="Tanggal Festival" value="<?=
$nm['tanggal']; ?>">
</div>
<div class="form-group">
<textarea style="height: 80px;" class="form-control"
id="deskripsi" name="deskripsi"><?= $nm['deskripsi']; ?></textarea>
</div>
<div class="form-group">
<input type="text" class="form-control" id="email_id"
name="email_id" value="<?= $_SESSION['email']; ?>" readonly>
</div>
<div class="form-group row">
<div class="col-sm-2">Picture</div>
<div class="col-sm-10">
<div class="row">
<div class="col-sm-4">
<img src="<?= base_url('assets/img/posting/') .
$nm['image']; ?>" class="img-thumbnail">
</div>
<div class="col-sm-8">
<div class="custom-file">
<input type="file" class="custom-file-input"
id="usr_image" name="usr_image">
<label class="custom-file-label"
for="usr_image">Choose 1:1 image...</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-
dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Add</button>
<? echo form_close(); ?>
</div>
</div>
</div>
</div>
</div>
</ div>
</div>
Aucun commentaire:
Enregistrer un commentaire