CodeIgniter Forums
preg_replace on $this->input->post values - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: preg_replace on $this->input->post values (/thread-46341.html)

preg_replace on $this->input->post values - El Forum - 10-28-2011

Hi all,

I'm having a problem changing post values, preg_replace for example.

For example when I use this code:

$this->input->post('constant') = preg_replace('@,@', '.', $this->input->post('constant'));
$this->db->where('id', $this->input->post('id'));
$this->db->update('form_lists_sub', $this->input->post());

I get the error: Fatal error: Can't use method return value in write context in

but when I use the method with $_POST like this it works fine:

$_POST['constant'] = preg_replace('@,@', '.', $_POST['constant']);
$this->db->where('id', $this->input->post('id'));
$this->db->update('form_lists_sub', $this->input->post());

So I could use the normal post method but I prefer to use the codeigniter functions.

Any thoughts?

Thanks in advanced!