how to pass array from view to controller?

Codeigniter Mysql Mysqli php Programming Technology

Question: how to pass array from view to controller?

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Codeigniter Retrieve Parameter values passed from View to Controller

In this Post We Will Explain About is Codeigniter Retrieve Parameter values passed from View to Controller With Example and how to pass array from view to controller Demo.Welcome on – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to how to pass array from view to controller Example

also you can read my prev Post Like as self join, left join, multiple joins, sql join multiple tables, with codeigniter join 2 tables, and join 3 tables in codeigniter as well as Join with multiple tables.

In this post we will show you Best way to implement GET parameters in the URL with CodeIgniter, hear for Codeigniter passing parameters to controller indexwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

How to get id from URL in codeigniter


<h2>How to get current url with query string in codeigniter</h2>
echo "<a href='product_delete_controller?cat_id=$cat_id'>";
echo $name;
echo "</a>";

if we have to pass the value we should enter simple url like this


in controller function we can read like this

function product_delete_controller( $cat_id = NULL ) {
  echo $cat_id;

Onther Way

echo $this->uri->segment('3');

codeigniter get value from url Example

Your URL using Codeigniter View

recieve the param value in a controller from the simple following URL using codeigniter


In Codeigniter we can simply do

public function get_Products($items)
   var_dump($items); //will output "items=123"

How To Get Last ID From URL In Codeigniter

It permits simple we to retrieve a last ID or segment from the URI using Codeigniter Example. There are the following 3 Example to Retrive Codeigniter Last segment.

Example 1 : codeigniter get url query string

$get_last = end($this->uri->segments); 
//Where here best way to, segments is a class simple variable.

Example 2 : php – How to get ID from site url in view page

$get_last = end($this->uri->segment_array());

Example 3 : how to get id from view to controller in codeigniter

$total_seg = $this->uri->total_segments();
$get_last = $this->uri->segment($total_seg);


I hope you have Got What is how to pass id from view to controller in codeigniter And how it works.I would Like to have FeadBack From My Blog( readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article( Are Most Always Welcome.

Related FAQ

Here are some more FAQ related to this Article:

  1.   How to Create a Wordpress Plugin in 10 Minutes Flat
  2.   codeigniter load multiple view inside view template
  3.   Handling Active Navigation Menu in Laravel Example
  4.   How to convert date format in PHP?
  5.   PHP Add JSON object Data Example
  6.   Simple HTML5 Canvas Tutorial Examples
  7.   Elementor cpt select Integration
  8.   CodeIgniter CRUD Example Tutorial From Scratch
  9.   AngularJS Adding Form Fields Dynamically with PHP MySQLi
  10.   Update query in codeigniter Example

Leave a Reply

Your email address will not be published. Required fields are marked *