Sending a parameter from the controller for viewing

Is there any way to send data from the controller for viewing. what I am doing is that the user has the ability to link, and according to the user’s links, clicks the corresponding data is transferred to the controller, and another view is downloaded from the controller corresponding to this link. But I do not know how to do this. I use bonfire here is my controller code: -

function my_tickets() {
        $username = $this->auth->username();
        $this->load->model('helpdesk_model');
        $result_set = $this->helpdesk_model->my_tickets($username);
        foreach($result_set->result()  as $data ) {
            $title[] = $data->title;
            $category[]=$data->category;
            $priority[]=$data->priority;
            $date[]=$data->date;
            $post_status[]=$data->post_status;
            $userfile_path[] = $data->userfile_path;
        }
        $arraysize=count($title);
        Template::set('arraysize',$arraysize);
        Template::set('title',$title);
        Template::set('category',$category);
        Template::set('priority',$priority);
        Template::set('date',$date);
        Template::set('post_status',$post_status);
        Template::set('username',$this->auth->username());
        Template::set('userfile_path',$userfile_path);
        Template::render();
    }
    function full_post(){
        Template::render();
    }
    }

In my part of the model: -

function my_tickets($username){
        $this->db->select('title,userfile_path,category,priority,date,post_status');
        $this->db->where('username',$username);
        $result = $this->db->get('tbl_tickets');
        return $result;
        }

My views: -

<?php 
$arraysize =Template::get('arraysize');
$title[] = Template::get('title');
$category[]=Template::set('category');
$priority[]=Template::set('priority');
$date[]=Template::set('date');
$post_status[]=Template::set('post_status');
$username = Template::set('username');
$userfile_path = Template::set('userfile_path');
?>
<h3>Total Number Of posts :&nbsp; <?php echo $arraysize; ?> </h3>
<h2>Your Posts</h2>
<?php echo "serail. title | category | priority | date of starting post | post status "; ?> 
<?php 
    for ($i=0; $i <$arraysize; $i++) { 
    ?>
    <p> <?php echo ($i+1).". ".$title[$i]." | ".$category[$i]." | ".$priority[$i]." | ".$date[$i]." | ".$post_status[$i]; 
            echo "<a href=\"/helpdesk/full_post\">Click to see </a>";
        ?>
    </p>
    <?php
   } 
   ?>

In my full_post controller function, I need a parameter that the user clicks on the link click to see. helpdesk is my controller name. helpdesk_model is my model name. as well as my_tickets is my view name.

+5
source share
2 answers

, : - : -

for ($i=0; $i <$arraysize; $i++) { 
    echo "<p>".($i+1).". ".$title[$i]." | ".$category[$i]." | ".$priority[$i]." | ".$date[$i]." | ".$post_status[$i]."</p>";
    echo form_open('/helpdesk/full_post');
    echo form_hidden('path',$userfile_path[$i]);
    echo form_submit('submit', 'click to see');
    echo form_close();
   } 

: -

function full_post(){
        Template::set('path',$this->input->post('path'));
        Template::render();
        }

, , .? ?..

+1

.

echo anchor('controller/functionName/parameter','display text');

function functionName($parameter ='')
{
    //Do something with the parameter here when user click on the displayed text.
}

, , .

0

All Articles