Welcome Guest, Not a member yet? Register   Sign In
Strtoupper
#3

Hi Wouter60, 

Thanks for reply. Yah, that code works. I have that way! I was looking for some clean code [best practices].

I think that in the validation rules will be better, so can be shared in all controller methods.... It's not supposed to validation rules run native PHP functions? trim works just fine, but strtoupper no....

(08-26-2019, 12:25 PM)Wouter60 Wrote: Let's say you have 2 input fields: 'city' and 'country'. You want to save both fields in uppercase in the 'cities' table.

Controller:
PHP Code:
$data = array(
 
  'city' => strtoupper($this->input->post('city')),
 
  'country' => strotupper($this->input->post('country'))
);
$this->db->insert('cities'$data); 
Reply


Messages In This Thread
Strtoupper - by jesuscampos - 08-26-2019, 10:54 AM
RE: Strtoupper - by Wouter60 - 08-26-2019, 12:25 PM
RE: Strtoupper - by jesuscampos - 08-27-2019, 01:01 AM
RE: Strtoupper - by dave friend - 08-27-2019, 08:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB