Usage of implode in OOP (cognitive framework)

14 Views Asked by At

we have a code like below:

            `$arrayUstKat = array();
            if(isset($_POST["ust_id"]))
            {
            foreach ($_POST["ust_id"] as $UstKat)
            $arrayUstKat[] =$UstKat;
            }  
            $stringSTR = implode(",", $arrayUstKat);`

So, we have to implement this code to OOP framework (cognitive framework)

            `$insert = $this->urun_kategori_model->add(
            array(
            "title"         => $this->input->post("title"),
            "ust_id"        => $this->input->post("ust_id"),
            "isActive"      => 1,
            "createdAt"     => date("Y-m-d H:i:s")
            )
            );`


            `public function post($index = NULL, $xss_clean = NULL)
            {
            return $this->_fetch_from_array($_POST, $index, $xss_clean);
            }`

This OOP function takes only one value from the form, but we want to take all values from select multiple object with our implode code above. Can anyone help us about this?

Hello, we have a code like below:

            `$arrayUstKat = array();
            if(isset($_POST["ust_id"]))
            {
            foreach ($_POST["ust_id"] as $UstKat)
            $arrayUstKat[] =$UstKat;
            }  
            $stringSTR = implode(",", $arrayUstKat);`

So, we have to implement this code to OOP framework (cognitive framework)

            `$insert = $this->urun_kategori_model->add(
            array(
            "title"         => $this->input->post("title"),
            "ust_id"        => $this->input->post("ust_id"),
            "isActive"      => 1,
            "createdAt"     => date("Y-m-d H:i:s")
            )
            );`

            `public function post($index = NULL, $xss_clean = NULL)
            {
            return $this->_fetch_from_array($_POST, $index, $xss_clean);
            }`

This OOP function takes only one value from the form, but we want to take all values from select multiple object with our implode code above. Can anyone help us about this?

0

There are 0 best solutions below