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

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



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

[eluser]Unknown[/eluser]
Hi all,

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

For example when I use this code:

Code:
unset($this->input->post('submit'));    
$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:

Code:
unset($_POST['submit']);    
$_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!