Welcome Guest, Not a member yet? Register   Sign In
Is there a way to combine these two functions? Category System
#3

(02-15-2018, 05:33 PM)skunkbad Wrote: Combining is easy:

PHP Code:
if( $subject_list $this->Posts_categories_model->get_list() )
{
 
   foreach$subject_list as $sub )
 
   {
 
       $data['subject_options'][$sub->id        $sub->title;
 
       $data['subject_name_options'][$sub->title] = $sub->title
 
   }


If I do that I just get them repated, the difference between them is the value would "value=1" or value="category-one".
Not just that I' trying to add them here(the first two lines):

PHP Code:
           $data = array(
                
'subject_id'    => $this->input->post('subject_id'),
// Obviously the input below will not work but I had to try it out.
                
'subject_name'    => $this->input->post($sub->title),
                
'slug'            => $slug,
                
'title'            => $this->input->post('title'),
                
'post_image'    => $post_image,
                
'body'            => $this->input->post('body'),
                
'is_published'    => $this->input->post('is_published'),
 
           ); 


Doing it as you say it would just fill the subject_id input, and I want one input to fill the two values.
How can I fill in the second value(subject_name) according to the subject_id?
I do Front-End development most of the time 
Reply


Messages In This Thread
RE: Is there a way to combine these two functions? Category System - by kirasiris - 02-15-2018, 06:37 PM



Theme © iAndrew 2016 - Forum software by © MyBB