CodeIgniter Forums
set_value() problems - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: set_value() problems (/showthread.php?tid=54463)

Pages: 1 2


set_value() problems - El Forum - 09-11-2012

[eluser]kodkanyon[/eluser]
My problem is exactly this, even if i tried all the solutions there i couldn't get it work
http://thephpcode.com/blog/codeigniter/repopulate-form-fields-in-codeigniter

Code:
function kaydet(){
  $form_kural = array(
   array('field' => 'adi', 'label' => 'Sayfa Adı', 'rules' => 'trim|required|min_length[2]|max_length[255]|escape_str'),
   array('field' => 'baslik', 'label' => 'Başlık', 'rules' => 'trim'),
   array('field' => 'bloklar[]', 'label' => 'Bloklar', 'rules' => ''),
   array('field' => 'gosterim', 'label' => 'Gösterim', 'rules' => ''),
   array('field' => 'mdurum', 'label' => 'Sayfanın Durumu', 'rules' => ''),
   array('field' => 'url', 'label' => 'Url', 'rules' => 'trim|required|min_length[2]|max_length[255]|escape_str|callback__urlkontrol')
  );

  $this->form_validation->set_rules($form_kural);

if ($this->form_validation->run() == FALSE)  
{
  $this->session->set_flashdata('error', $this->form_validation->_error_array);
  
  // set_value('adi') posts info on screen
  
  redirect('admin/pages/add','refresh');
}



set_value() problems - El Forum - 09-11-2012

[eluser]michalsn[/eluser]
This is your problem:
Code:
redirect('admin/pages/add','refresh');



set_value() problems - El Forum - 09-11-2012

[eluser]kodkanyon[/eluser]
So any idea how to solve it?


set_value() problems - El Forum - 09-11-2012

[eluser]michalsn[/eluser]
Don't use redirects.
Just call your view file:
Code:
$this->load->view('your_view_file_for_admin/pages/add');



set_value() problems - El Forum - 09-11-2012

[eluser]kodkanyon[/eluser]
The problem continues to Sad