Wednesday, 15 June 2011

php - Not getting all the post data codeigniter -



php - Not getting all the post data codeigniter -

my model function not getting post info information , there when click on submit button through error. should still process, keeps on saying wrong database name when there 1 ready.

all input arrays working ok need able info on same controller.

$data['db_hostname'] = $this->input->post('db_hostname'); $data['db_username'] = $this->input->post('db_username'); $data['db_password'] = $this->input->post('db_password'); $data['db_database'] = $this->input->post('db_database'); $data['db_driver'] = $this->input->post('db_driver'); $data['db_prefix'] = $this->input->post('db_prefix'); $this->load->model('model_install'); $this->model_install->database($this->input->post(null, true));

tried

$this->model_install->database($this->input->post());

tried

$this->model_install->database($this->input->get());

tried

$this->model_install->database($this->input->get_post());

on model

public function database() { $data['db_prefix'] = $this->input->post('db_prefix'); $file = fcpath . '/codeigniter.sql'; if (!file_exists($file)) { exit('could not load sql file: ' . $file); } $lines = file($file); if ($lines) { $sql = ''; foreach($lines $line) { if ($line && (substr($line, 0, 2) != '--') && (substr($line, 0, 1) != '#')) { $sql .= $line; if (preg_match('/;\s*$/', $line)) { $sql = str_replace("drop table if exists `", "drop table if exists `" . $data['db_prefix'], $sql); $sql = str_replace("create table `", "create table `" . $data['db_prefix'], $sql); $sql = str_replace("insert `", "insert `" . $data['db_prefix'], $sql); $this->db->query($sql); $sql = ''; } } } } }

first post datas in array , send array model function.

to post data

$xxxx=$this->input->post('yyyy');

storing post info in array

$data=array( 'field_name_in_table'=>$xxxx );

sending model

$this->model_install->database($data);

model function is

public function database($dat) { if ($this->db->insert('table_name', $dat)) { homecoming $this->db->insert_id(); } else { homecoming false; } }

php codeigniter

No comments:

Post a Comment