CodeIgniter Forums

Full Version: preg_replace on $this->input->post values
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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!