Severity: warning message: implode(): invalid arguments passed

Hallo rekan rekan sekolahkoding.com, selamat sore saya disini ingin bertanya di form yang saya buat terdapat 4 checkbox yang berbeda dan masing masing checkbox terdapat 6 kondisi. nah saat salah satu checkbox tidak ada yang ceklis sama sekali akan muncul error Severity: Warning Message: implode(): Invalid arguments passed.

controller/Skegiatan.php

public function tambah_data()
	{
		$kegiatan_harian= array('tanggal_kegiatan'=> $this->input->post('tgl_kegiatan'),
								'nama_sales'      => $this->input->post('nmsales'),
								'keterangan1'     => implode(', ', $this->input->post('keterangan1', TRUE)),
								'waktu1' 		  => $this->input->post('waktu1'),
								'keterangan2'	  => implode(', ', $this->input->post('keterangan2', TRUE)),
								'waktu2'	 	  => $this->input->post('waktu2'),
								'keterangan3'	  => implode(', ', $this->input->post('keterangan3', TRUE)),
								'waktu3'	   	  => $this->input->post('waktu3'),
								'keterangan4'	  => implode(', ', $this->input->post('keterangan4', TRUE)),
								'waktu4' 		  => $this->input->post('waktu4')
							);
		$this->db->insert('kegiatan_sales',$kegiatan_harian);
		redirect('skegiatan');
	}

View/kegiatan_harian/input_kegiatan_harian.php

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>

 <div class="container-fluid">

    <!-- Page Heading -->
    <h1 class="h3 mb-4 text-gray-800">Input Kegiatan Sales</h1>
    <?php echo form_open_multipart('skegiatan/tambah_data') ?>
<form>
	<div class="form-group">
    		<label for="tgl_kegiatan">Tanggal Input</label>
    		<input type="text" class="form-control" name="tgl_kegiatan" id="tgl_kegiatan" aria-describedby="tgl_kegiatan" value="<?php echo tanggal('helpers/tanggal_helper'); ?>" readonly>
  		  </div>
	<div class="form-group">
    		<label for="nmsales">Nama Sales</label>
    		<input type="text" class="form-control" name="nmsales" id="nmsales" aria-describedby="nmsales" value="<?= $user['name']?>" readonly required>
  		  </div>
          <div class="form-group">
  <hr class="divider">
  <div class="row">
  	    <div class="col">

        <!-- Jam 08.00 - 08.30-->
        <label>Jam</label>
    		<input type="text" name="waktu1" class="form-control" value="08.00-08.30" readonly> <br>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="1checkbox1" name="keterangan1[]" class="custom-control-input" value="Copy Writing" >
          <label class="custom-control-label" for="1checkbox1">Copywriting</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="1checkbox2" name="keterangan1[]" class="custom-control-input" value="Brodcast WA">
          <label class="custom-control-label" for="1checkbox2">Brodcast Wa</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="1checkbox3" name="keterangan1[]" class="custom-control-input" value="Medsos">
          <label class="custom-control-label" for="1checkbox3">Medsos</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="1checkbox4" name="keterangan1[]" class="custom-control-input" value="Telpon">
          <label class="custom-control-label" for="1checkbox4">Telpon</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="1checkbox5" name="keterangan1[]" class="custom-control-input" value="Kirim Email">
          <label class="custom-control-label" for="1checkbox5">Kirim Email </label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="1checkbox26" name="keterangan1[]" class="custom-control-input" value="Ishoma">
          <label class="custom-control-label" for="1checkbox26">Ishoma</label>
        </div>
        <input type="text" name="catatan2" class="form-control" placeholder="Tambah Keterangan" maxlength="100">
        <hr class="divider" style="border-top-color: red;">

        <!-- Jam 08.30 - 09.00-->
        <label>Jam</label>
            <input type="text" name="waktu2" class="form-control" value="08.30-09.00" readonly><br>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="2checkbox1" name="keterangan2[]" class="custom-control-input" value="Copy Writing" >
          <label class="custom-control-label" for="2checkbox1">Copywriting</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="2checkbox2" name="keterangan2[]" class="custom-control-input" value="Brodcast WA">
          <label class="custom-control-label" for="2checkbox2">Brodcast Wa</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="2checkbox3" name="keterangan2[]" class="custom-control-input" value="Medsos">
          <label class="custom-control-label" for="2checkbox3">Medsos</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="2checkbox4" name="keterangan2[]" class="custom-control-input" value="Telpon">
          <label class="custom-control-label" for="2checkbox4">Telpon</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="2checkbox5" name="keterangan2[]" class="custom-control-input" value="Kirim Email">
          <label class="custom-control-label" for="2checkbox5">Kirim Email </label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="2checkbox6" name="keterangan2[]" class="custom-control-input" value="Ishoma">
          <label class="custom-control-label" for="2checkbox6">Ishoma</label>
        </div>
        <input type="text" name="catatan2" class="form-control" placeholder="Tambah Keterangan" maxlength="100">
        <hr class="divider" style="border-top-color: red;">


    	<label>Jam</label>
    		<input type="text" name="waktu3" class="form-control" value="09.00-09.30" readonly><br>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="3checkbox1" name="keterangan3[]" class="custom-control-input" value="Copy Writing" >
          <label class="custom-control-label" for="3checkbox1">Copywriting</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="3checkbox2" name="keterangan3[]" class="custom-control-input" value="Brodcast WA">
          <label class="custom-control-label" for="3checkbox2">Brodcast Wa</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="3checkbox3" name="keterangan3[]" class="custom-control-input" value="Medsos">
          <label class="custom-control-label" for="3checkbox3">Medsos</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="3checkbox4" name="keterangan3[]" class="custom-control-input" value="Telpon">
          <label class="custom-control-label" for="3checkbox4">Telpon</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="3checkbox5" name="keterangan3[]" class="custom-control-input" value="Kirim Email">
          <label class="custom-control-label" for="3checkbox5">Kirim Email </label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="3checkbox26" name="keterangan3[]" class="custom-control-input" value="Ishoma">
          <label class="custom-control-label" for="3checkbox26">Ishoma</label>
        </div>
        <input type="text" name="catatan2" class="form-control" placeholder="Tambah Keterangan" maxlength="100">
        <hr class="divider" style="border-top-color: red;">


    	<label>Jam</label>
    		<input type="text" name="waktu4" class="form-control" value="09.30-10.00" readonly><br>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="4checkbox1" name="keterangan4[]" class="custom-control-input" value="Copy Writing" >
          <label class="custom-control-label" for="4checkbox1">Copywriting</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="4checkbox2" name="keterangan4[]" class="custom-control-input" value="Brodcast WA">
          <label class="custom-control-label" for="4checkbox2">Brodcast Wa</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="4checkbox3" name="keterangan4[]" class="custom-control-input" value="Medsos">
          <label class="custom-control-label" for="4checkbox3">Medsos</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="4checkbox4" name="keterangan4[]" class="custom-control-input" value="Telpon">
          <label class="custom-control-label" for="4checkbox4">Telpon</label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="4checkbox5" name="keterangan4[]" class="custom-control-input" value="Kirim Email">
          <label class="custom-control-label" for="4checkbox5">Kirim Email </label>
        </div>
        <div class="custom-control custom-checkbox custom-control-inline">
          <input type="checkbox" id="4checkbox6" name="keterangan4[]" class="custom-control-input" value="Ishoma">
          <label class="custom-control-label" for="4checkbox6">Ishoma</label>
        </div>
        <input type="text" name="catatan2" class="form-control" placeholder="Tambah Keterangan" maxlength="100">
        <hr class="divider" style="border-top-color: red;">


</div>
  <button type="submit" class="btn btn-primary btn-lg btn-block">Simpan</button>
  <a type="cancel" href="<?php echo base_url('skegiatan');?>" class="btn btn-danger btn-lg btn-block">Kembali</a>
  <?php echo form_close()?>
</form>
</div>

ini contoh formnya, jadi bila sebelah kiri diisi dan seblah kanan kosong saat disimpan, akan muncul pesan "implode(): invalid arguments passed"... Mohon bantuannya gan :(

Mohon Bantuannya

avatar ajhosan
@ajhosan

6 Kontribusi 0 Poin

Dipost 5 tahun yang lalu

1 Jawaban:

Jawaban Terpilih

Sudah Bisa Gan, Terimakasih

avatar ajhosan
@ajhosan

6 Kontribusi 0 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban