Welcome Guest, Not a member yet? Register   Sign In
Codeigniter - Indonesia Community

haloo semua. mau nanya nih kawan2. mohon bantuannya ya.
//ini viewnya//

Code:
$no = 1;
                  $asked = $this->db->query("SELECT * FROM kuisioner where id_dimensi = '" . $ks['id'] . "'",);
                  foreach ($asked->result_array() as $ask) {
                  ?>
                    <input type="text" name="<?= $this->session->userdata('nama'); ?>" value="<?= $this->session->userdata('nama'); ?>">
                    <tr>

                      <td bgcolor=#F9EDED align="center">
                        <font face="Calibri" size="3"><?= $no ?></font>
                      </td>
                      <td bgcolor=#F9EDED>
                        <font face="Calibri" size="3"><?= $ask['pertanyaan'] ?></font>
                      </td>

                      <td bgcolor=#F9EDED align="center">
                        <input name="p[<?= $ask['id_kuisioner'] ?>]" type="radio" value="1" required>
                      </td>
                      <td bgcolor=#F9EDED align="center">
                        <input name="p[<?= $ask['id_kuisioner'] ?>]" type="radio" value="2" required>
                      </td>
                      <td bgcolor=#F9EDED align="center">
                        <input name="p[<?= $ask['id_kuisioner'] ?>]" type="radio" value="3" required>
                      </td>
                      <td bgcolor=#F9EDED align="center">
                        <input name="p[<?= $ask['id_kuisioner'] ?>]" type="radio" value="4" required>
                      </td>

                      <td bgcolor=#F9EDED align="center">
                        <input name="i[<?= $ask['id_kuisioner'] ?>]" type="radio" value="1" required>
                      </td>
                      <td bgcolor=#F9EDED align="center">
                        <input name="i[<?= $ask['id_kuisioner'] ?>]" type="radio" value="2" required>
                      </td>
                      <td bgcolor=#F9EDED align="center">
                        <input name="i[<?= $ask['id_kuisioner'] ?>]" type="radio" value="3" required>
                      </td>
                      <td bgcolor=#F9EDED align="center">
                        <input name="i[<?= $ask['id_kuisioner'] ?>]" type="radio" value="4" required>
                      </td>
                    </tr>


jika view saya begini, di controller untuk syntax simpan dan tambah data ke database nya gimana ya kawan2?

Code:
sebelumnyya saya buat controller seperti dibawah ini 

Code:
public function add()
  {
    $data = [
      'nama_responden' => $this->input->post('nama'),
      'p1' => $this->input->post('p1'),
      'p2' => $this->input->post('p2'),
      'p3' => $this->input->post('p3'),
      'p4' => $this->input->post('p4'),
      'p5' => $this->input->post('p5'),
      'p6' => $this->input->post('p6'),
      'p7' => $this->input->post('p7'),
      'p8' => $this->input->post('p8'),
      'p9' => $this->input->post('p9'),
      'p10' => $this->input->post('p10'),
      'p11' => $this->input->post('p11'),
      'p12' => $this->input->post('p12'),
      'p13' => $this->input->post('p13'),
      'p14' => $this->input->post('p14'),
      'p15' => $this->input->post('p15'),
      'i1' => $this->input->post('i1'),
      'i2' => $this->input->post('i2'),
      'i3' => $this->input->post('i3'),
      'i4' => $this->input->post('i4'),
      'i5' => $this->input->post('i5'),
      'i6' => $this->input->post('i6'),
      'i7' => $this->input->post('i7'),
      'i8' => $this->input->post('i8'),
      'i9' => $this->input->post('i9'),
      'i10' => $this->input->post('i10'),
      'i11' => $this->input->post('i11'),
      'i12' => $this->input->post('i12'),
      'i13' => $this->input->post('i13'),
      'i14' => $this->input->post('i14'),
      'i15' => $this->input->post('i15')

    ];

    $this->db->insert('respon_kuisioner', $data);
    $this->session->set_flashdata('message', '<div class="alert alert-success" role="alert">
      Jawaban sudah di input
    </div>');
    redirect('responden/dashboard');
  }

tapi malah pesan errornya database error karena data yang udah input gk kebaca alias null.

jadi gimana ya solusi untuk controller nya kawan

btw ini saya pake CI3 
tolong direspon ya kwn2. program skripsi soalnya wkwk
Reply


Messages In This Thread
RE: Codeigniter - Indonesia Community - by antoub - 12-22-2014, 10:57 AM
RE: Codeigniter - Indonesia Community - by ridho - 01-03-2015, 03:51 AM
RE: Codeigniter - Indonesia Community - by twonno - 12-07-2016, 08:03 PM
RE: Codeigniter - Indonesia Community - by cakka - 01-23-2015, 06:43 AM
halo - by algenza - 01-28-2015, 11:49 PM
RE: Codeigniter - Indonesia Community - by andgaa - 02-04-2015, 09:51 PM
RE: Codeigniter - Indonesia Community - by Ferry - 02-06-2015, 11:28 AM
RE: Codeigniter - Indonesia Community - by s4if - 02-08-2015, 05:14 AM
RE: Codeigniter - Indonesia Community - by cakka - 02-24-2015, 09:45 PM
RE: Codeigniter - Indonesia Community - by dotphp - 03-07-2015, 06:15 PM
RE: Codeigniter - Indonesia Community - by freddy - 03-09-2015, 02:18 AM
RE: Codeigniter - Indonesia Community - by khalim - 03-21-2015, 12:22 AM
RE: Codeigniter - Indonesia Community - by Iman - 04-01-2015, 07:29 AM
RE: Codeigniter - Indonesia Community - by hotben - 04-02-2015, 03:06 AM
RE: Codeigniter - Indonesia Community - by tirta - 04-23-2015, 11:16 PM
RE: Codeigniter - Indonesia Community - by H4nk - 06-01-2015, 12:42 PM
RE: Codeigniter - Indonesia Community - by jureks - 06-04-2015, 11:23 PM
RE: Codeigniter - Indonesia Community - by dv23 - 08-04-2015, 01:13 AM
RE: Codeigniter - Indonesia Community - by dv23 - 08-04-2015, 01:15 AM
RE: Codeigniter - Indonesia Community - by lomri - 08-09-2015, 02:48 AM
RE: Codeigniter - Indonesia Community - by tegs88 - 09-08-2015, 01:23 PM
RE: Codeigniter - Indonesia Community - by cakka - 11-07-2015, 07:10 AM
RE: Codeigniter - Indonesia Community - by redha - 01-27-2016, 09:12 PM
RE: Codeigniter - Indonesia Community - by epox2 - 02-17-2016, 08:25 PM
RE: Codeigniter - Indonesia Community - by akuila - 03-21-2016, 02:23 AM
RE: Codeigniter - Indonesia Community - by needle - 04-14-2016, 03:41 PM
website dengan codeigniter - by suhindra - 04-16-2016, 07:36 AM
RE: Codeigniter - Indonesia Community - by aldy - 04-19-2016, 03:05 AM
RE: Codeigniter - Indonesia Community - by siprox - 05-22-2016, 11:34 PM
RE: Codeigniter - Indonesia Community - by unto - 06-07-2016, 01:46 PM
RE: Codeigniter - Indonesia Community - by adty - 06-26-2016, 09:14 PM
RE: Codeigniter - Indonesia Community - by citra - 09-02-2016, 09:20 PM
RE: Codeigniter - Indonesia Community - by Wau - 10-06-2016, 10:35 PM
RE: Codeigniter - Indonesia Community - by twonno - 12-07-2016, 08:04 PM
RE: Codeigniter - Indonesia Community - by uyak - 01-05-2017, 08:54 PM
RE: Codeigniter - Indonesia Community - by rofik - 02-23-2017, 08:47 PM
RE: Codeigniter - Indonesia Community - by dycas - 01-22-2017, 05:15 PM
RE: Codeigniter - Indonesia Community - by mrw7a - 05-01-2017, 08:43 PM
RE: Codeigniter - Indonesia Community - by tamam - 10-10-2017, 07:01 PM
RE: Codeigniter - Indonesia Community - by Wily23 - 11-03-2017, 01:42 AM
RE: Codeigniter - Indonesia Community - by Wily23 - 11-03-2017, 05:47 AM
RE: Codeigniter - Indonesia Community - by DELE - 09-10-2018, 08:06 AM
RE: Codeigniter - Indonesia Community - by gopei - 10-23-2018, 07:19 PM
RE: Codeigniter - Indonesia Community - by 49boys - 04-29-2019, 05:56 PM
RE: Codeigniter - Indonesia Community - by imam - 11-30-2019, 10:04 AM
RE: Codeigniter - Indonesia Community - by Haidir - 12-03-2019, 10:54 AM
RE: Codeigniter - Indonesia Community - by siprox - 03-31-2020, 01:53 AM
RE: Codeigniter - Indonesia Community - by nuja - 11-13-2020, 02:00 AM
RE: Codeigniter - Indonesia Community - by bangil - 07-27-2020, 12:40 AM
RE: Codeigniter - Indonesia Community - by nuja - 11-13-2020, 02:03 AM
RE: Codeigniter - Indonesia Community - by aahas - 08-20-2021, 12:02 AM
RE: Codeigniter - Indonesia Community - by cocix - 11-08-2021, 07:06 PM
RE: Codeigniter - Indonesia Community - by dewaz - 11-09-2021, 03:27 AM
RE: Codeigniter - Indonesia Community - by inisaya - 06-24-2022, 10:59 PM
RE: Codeigniter - Indonesia Community - by myads - 08-26-2022, 12:55 AM
RE: Codeigniter - Indonesia Community - by erysai - 06-26-2024, 10:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB