Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (68414 Members, 793 Products, 5353 Topic, 13045 Comments)

Error pada form pendaftaran order dan error form hubungi pada CI

Dibuat
Login Terakhir 1 Tahun lalu,
Telah Dilihat 873 Kali
indrianto adi Mengatakan : Sultan Account
  1. Assalamualaikum Warahmatullahi Wabarakatuh...
  2.  
  3. Saya memiliki kendala pada saat isi form pendaftaran order di halaman detail paket dan form hubungi tetapi tidak bisa ke simpan ke db, mohon bantuannya ya.. thanks
  4. //controlldetail order
  5. public function detail(){
  6. $id = $this->uri->segment(2);
  7. $query = $this->model_app->getjoinpaket2($id);
  8. //$query = $this->model_utama->view_join_two('cmstour','users','cms_itinerary','username','idtour',array('judul_seo' => $this->uri->segment(3)),'idtour','DESC',0,1);
  9. if ($query->num_rows()<=0){
  10. redirect('Main');
  11. }else{
  12. $row = $query->row_array();
  13. //$spell = cetak_meta($row['description']);
  14. $data['title'] = cetak($row['title']);
  15. $data['description'] = cetak_meta($row['description'],0,500);
  16. $data['keywords'] = cetak($row['description']);
  17. $data['rows'] = $row;
  18.  
  19. $dataa = array('dibaca'=>$row['dibaca']+1);
  20. $where = array('idtour' => $row['idtour']);
  21. $this->model_utama->update('cmstour', $dataa, $where);
  22.  
  23. $data['paket'] = $this->model_app->getjoinpaket();
  24.  
  25. $data['regiscode'] = $this->model_app->getcode();
  26. //$this->db->get('paket_umroh')->result_array();
  27. // $data['us'] = $this->model_app->view_where('users',array('username'=>$this->session->username))->row_array();
  28. $this->template->load(template().'/template',template().'/detailpaket',$data);
  29. }
  30. }
  31.  
  32. //formorder
  33. function kirim(){
  34. if (isset($_POST['submit'])){
  35.  
  36. $cek = $this->model_utama->view_where('cmstour',array('idtour' => $this->input->post('id_paket')));
  37. $row = $cek->row_array();
  38. if ($cek->num_rows()<=0){
  39. redirect('main');
  40. }else{
  41. if ($this->input->post()) {
  42. $data = array('idtour'=>cetak($this->db->escape_str($this->input->post('id_tour',TRUE))),
  43. 'idkattour'=>cetak($this->db->escape_str($this->input->post('id_kate',TRUE))),
  44. 'fullname'=>cetak($this->db->escape_str($this->input->post('full_name',TRUE))),
  45. 'no_identitas'=>cetak($this->db->escape_str($this->input->post('no_identitas_',TRUE))),
  46. 'nama_ayah_kandung'=>cetak($this->db->escape_str($this->input->post('nama_ayah_kandung_',TRUE))),
  47. 'email'=>cetak($this->db->escape_str(strip_tags($this->input->post('email_',TRUE)))),
  48. 'tempat_lahir_'=>cetak($this->db->escape_str(strip_tags($this->input->post('tempat_lahir_',TRUE)))),
  49. 'no_hp'=>cetak($this->db->escape_str(strip_tags($this->input->post('no_hp_',TRUE)))),
  50. 'regiscode'=>cetak($this->db->escape_str(strip_tags($this->input->post('regiscode_',TRUE)))),
  51. 'tgl_daftar'=>date('Y-m-d'),
  52. 'jam_daftar'=>date('H:i:s'));
  53. $this->model_utama->insert('cms_regis_umroh',$data);
  54. //var_dump($data);
  55. // exit;
  56. echo $this->session->set_flashdata('message', '<div class="alert alert-success" style="margin-top:10px"><center>Terima kasih telah melakukan pemesanan, Staff kami akan menghubungi Anda dalam waktu dekat.</center></div>');
  57. }else{
  58. echo $this->session->set_flashdata('message', '<div class="alert alert-danger" style="margin-top:10px"><center>Oops..Please Checked Your identitation</center></div>');
  59. }
  60. }
  61.  
  62. redirect('paket/'.$row['seo_title']);
  63.  
  64. }
  65. }
  66.  
  67. //tampilan form order
  68.  
  69. <div class="col-lg-6 contact-left-form">
  70. <?php echo form_open('paket/kirim')?>
  71. <div class="col-sm-12 form-group contact-forms">
  72.  
  73. <input type="text" class="form-control" placeholder="Nama Lengkap" name='full_name' autocomplete="off" id="c_name" required />
  74. <input type="hidden" class="form-control" placeholder="Kode Registrasi" name='regiscode_' value="<?= $regiscode;?>"autocomplete="off" id="c_name" readonly />
  75. <input type="hidden" class="form-control" placeholder="Id Paket" name='id_tour' value="<?= $rows['idtour'];?>" autocomplete="off" id="c_name" required/>
  76. </div>
  77. <div class="col-sm-12 form-group contact-forms">
  78. <input type="number" class="form-control" placeholder="No Identitas (KTP, SIM, NIS)" name='no_identitas_' autocomplete="off" id="c_email" required/>
  79. </div>
  80. <div class="col-sm-12 form-group contact-forms">
  81. <input type="text" class="form-control" placeholder="Nama Ayah Kandung" name='nama_ayah_kandung_' autocomplete="off" id="c_email" required/>
  82. </div>
  83. <div class="col-sm-12 form-group contact-forms">
  84. <input type="email" class="form-control" placeholder="E-mail" name='email_' autocomplete="off" id="c_email" required/>
  85. </div>
  86. <div class="col-sm-12 form-group contact-forms">
  87. <input type="text" class="form-control" placeholder="Tempat lahir" name='tempat_lahir_' autocomplete="off" id="c_email" required/>
  88. </div>
  89. <div class="col-sm-12 form-group contact-forms">
  90. <input type="number" class="form-control" name='no_hp_' minlength="5" placeholder="Nomer HP" autocomplete="off" id="c_message" required />
  91. </div>
  92. <div class="col-md-12 booking-button">
  93. <input type="submit" name="submit" class="btn btn-primary btn-lg" value="Pesan" style="cursor:pointer;" onclick="return confirm('Pesan anda ini akan kami balas secepatnya')"/>
  94.  
  95. </div>
  96. <?php
  97. echo $this->session->flashdata('message');
  98. echo form_close();
  99. ?>
  100. </div>
  101.  
  102.  
  103.  
  104. //controller form_hubungi
  105. function kirim(){
  106. if (isset($_POST['submit'])){
  107. if ($this->input->post() && (strtolower($this->input->post('security_code')) == strtolower($this->session->userdata('mycaptcha')))) {
  108. $data = array('nama'=>cetak($this->input->post('name_',TRUE)),
  109. 'email'=>cetak($this->input->post('email_',TRUE)),
  110. 'subjek'=>$_SERVER['REMOTE_ADDR'],
  111. 'pesan'=>cetak($this->input->post('pesan_',TRUE)),
  112. 'tanggal'=>date('Y-m-d'),
  113. 'jam'=>date('H:i:s'));
  114. $this->model_utama->insert('hubungi',$data);
  115. echo $this->session->set_flashdata('message', '<div class="alert alert-success"><center>Pesan terkirim!, akan kami respon via email!</center></div>');
  116. }else{
  117. echo $this->session->set_flashdata('message', '<div class="alert alert-danger"><center>Periksa kembali data anda</center></div>');
  118. }
  119. redirect('hubungi');
  120. }
  121. }
  122.  
  123. //tampilan form
  124.  
  125. <div class="col-lg-12" >
  126. <?php echo form_open('hubungi/kirim', array('role'=>'form', 'class'=>'php-email-form'))?>
  127.  
  128. <div class="form-row">
  129. <div class="col-lg-6 form-group">
  130. <input type="text" name="name_" class="form-control" id="name" placeholder="Your Name" data-rule="minlen:4" data-msg="Masukan minimal 4 karakter" />
  131. <div class="validate"></div>
  132. </div>
  133. <div class="col-lg-6 form-group">
  134. <input type="email" class="form-control" name="email_" id="email" placeholder="Your Email" data-rule="email" data-msg="Masukan email dengan benar" />
  135. <div class="validate"></div>
  136. </div>
  137. </div>
  138. <div class="form-group">
  139. <textarea class="form-control" name="pesan_" rows="5" data-rule="required" data-msg="Pesan tidak boleh kosong" placeholder="Message"></textarea>
  140. <div class="validate"></div>
  141. </div>
  142. <div class="form-group">
  143.  
  144. <?php echo $image; ?><br></label>
  145. <input name='security_code' maxlength="6" type="text" class="form-control" placeholder="Masukkkan kode di atas..">
  146. </div>
  147. <div class="text-center"><input type="submit" name="submit" value="Send Message"></div>
  148.  
  149. </form>
  150. </div>

Ada 5 Jawaban

Hardiansyah
commented on 06 Apr 2020 14:24:42
  1. Assalamualaikum,..
  2. Pertama yaitu $id = $this->uri->segment(2); secara default ini akan mengambil nama fungsi dari sebuah controller, jd asumsi kalau ingin mengambil nilai maka dimulai dari $this->uri->segment(3) dst,
  3. Kedua <?php echo form_open('paket/kirim')?> form pada html default akan mengirimkan dengan metode GET, jd tambahkan metode nya POST krn nilai pada controller mengambil secara POST
  4. Silahkan baca panduan (user guide) pada Codeigniter
  5. CMIIW
indrianto adi
commented on 06 Apr 2020 21:01:18
  1. Assalamualaikum,..
  2. <?php echo form_open('paket/kirim')?> kalo ini otomatis mas nantinya
  3. tinggal di function diambil update atau insert, tidak masalah kalo ini
  4. $this->uri->segment(2) itu tergantung penerapannya gimana
  5. kebetulan itu saya pakai url seo friendly posisi ada di 2 setelah nama controller(pakai routes)
Hardiansyah
commented on 06 Apr 2020 23:04:52
  1. Assalamualaikum,.. jadi apakah masih error atau sudah ok?
  2. kalau ingin mengatasi error, tampilkan dulu erornya jd tahu lah apa penyebab eror, redirectnya di comment dulu, CI akan tampilkan erornya jika tdk berhasil atau var dump querynya, terus tes manual input di database, barangkali di database yg error
indrianto adi
commented on 07 Apr 2020 06:34:58
  1. Assalamualaikum,..
  2. belum bisa mas,
  3. di var_dump juga gak bisa padahal sudah saya comment // dibagian redirect('main'), $this->model_utama->insert(), echo sessioin set_flashdata sama redirect
  4. redirect('paket/'.$row['seo_title']);
indrianto adi
commented on 07 Apr 2020 06:37:34
  1. seperti ini kan yang di var_dumpnya atau print_r nya ?
  2.  
  3. function kirim(){
  4. if (isset($_POST['submit'])){
  5.  
  6. $cek = $this->model_utama->view_where('cmstour',array('idtour' => $this->input->post('id_paket')));
  7. $row = $cek->row_array();
  8. if ($cek->num_rows()<=0){
  9. //redirect('main');
  10. }else{
  11. if ($this->input->post()) {
  12. $data = array('idtour'=>cetak($this->db->escape_str($this->input->post('id_tour',TRUE))),
  13. 'idkattour'=>cetak($this->db->escape_str($this->input->post('id_kate',TRUE))),
  14. 'fullname'=>cetak($this->db->escape_str($this->input->post('full_name',TRUE))),
  15. 'no_identitas'=>cetak($this->db->escape_str($this->input->post('no_identitas_',TRUE))),
  16. 'nama_ayah_kandung'=>cetak($this->db->escape_str($this->input->post('nama_ayah_kandung_',TRUE))),
  17. 'email'=>cetak($this->db->escape_str(strip_tags($this->input->post('email_',TRUE)))),
  18. 'tempat_lahir_'=>cetak($this->db->escape_str(strip_tags($this->input->post('tempat_lahir_',TRUE)))),
  19. 'no_hp'=>cetak($this->db->escape_str(strip_tags($this->input->post('no_hp_',TRUE)))),
  20. 'regiscode'=>cetak($this->db->escape_str(strip_tags($this->input->post('regiscode_',TRUE)))),
  21. 'tgl_daftar'=>date('Y-m-d'),
  22. 'jam_daftar'=>date('H:i:s'));
  23. //$this->model_utama->insert('cms_regis_umroh',$data);
  24. var_dump($data);
  25. //echo $this->session->set_flashdata('message', '<div class="alert alert-success" style="margin-top:10px"><center>Terima kasih telah melakukan pemesanan, Staff kami akan menghubungi Anda dalam waktu dekat.</center></div>');
  26. }else{
  27. //echo $this->session->set_flashdata('message', '<div class="alert alert-danger" style="margin-top:10px"><center>Oops..Please Checked Your identitation</center></div>');
  28. }
  29. }
  30.  
  31. //redirect('paket/'.$row['seo_title']);
  32.  
  33. }
  34. }
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!

Online