CodeIgniter Laravel PHP Example Javascript jQuery MORE Videos New

Pass parameter from controller to view file - CodeIgniter framework

In this example we are going to show you how to Pass parameter from controller to view file in CodeIgniter framework PHP.

Here we using 2 files for pass parameter from controller to view:

  • parameter.php (CodeIgniter\application\controllers\parameter.php)
  • parameter_view.php (CodeIgniter\application\views\parameter_view.php)


if(!defined('BASEPATH')) exit('No direct script access allowed');  
class Parameter extends CI_Controller{  
/* declaring variables  */
		var $name; 
			function __construct(){ 
		/* passing value  */
		$this->name="Students Tutorial";  
		function tutorial()  
		/* define variable sent to views */


<!DOCTYPE html>  
    <title>Passing Parameter</title> 
    <h3>Welcome to <?php echo $name ;?> .</h3> 

Now run the program on your browser with the below URL:



Welcome to Students Tutorial .