0

How to send Data form view to controller through URL in codeigniter and how I get data in controller?

<div class="col-md-3 col-md-3-text"> <div class="classWithPad"><img src="<?php echo base_url(); echo 'assets/img/'; echo $title[$i]->image; ?>"/> <?php $id = $title[$i]->category_id; ?>
             <div class="title_banner"><a href="<?php echo site_url('Welcome/category','' ) ?>" class="mhover"><?php echo $title[$i]->category_name; ?></a></div>
            </div>
      </div>

send like this

1
  • You need to sent data via get method in url and need to use Input Class in controller to get the data from URL. Commented Mar 21, 2015 at 8:37

1 Answer 1

1

You have to use $_GET[] method of php:

<a href="<?php echo base_url()?>your_Controller/your_function?id=1">My Data</a>

This will redirect to your controller where you had your function and within your_function you have to use $_GET['id'] as

function your_function() {
    $id = $this->input->get('id');
}
Sign up to request clarification or add additional context in comments.

3 Comments

BUT the ID value genarated by a for loop, can i assign variable to ID?
can i have your mail this is mine [email protected]
i have send you a mail dr

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.