• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to access value from controller to view..

I am getting an error while accessing data from controller to view.
The $data variable 'ddlcountry' is inaccessible in my view.

following is the error code iam getting.

I am new to codeigniter. please suggest the possible error cause.

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: ddlcountry

Filename: views/register.php

Line Number: 59


File: C:\xampp\htdocs\JobPortal\application\views\register.php
Line: 59
Function: _error_handler

File: C:\xampp\htdocs\JobPortal\application\controllers\JS_Register.php
Line: 18
Function: view

File: C:\xampp\htdocs\JobPortal\index.php
Line: 292
Function: require_once

Paste your code from controller and view Wink

I doubt this will enlighten you in any way, but that error is telling you that you have referenced a variable called ddlcountry on line 59 of your register.php view that has not been defined.

I am sure that has been no help at all :-)

Best wishes,


(08-13-2015, 06:25 AM)[email protected] Wrote: To help solve your problem, please supply the following:

1. conroller source code showing how you allocate  $data[ 'ddlcountry' ]
2. controller source code showing how the $data is passed to the view.
3. view source code showing how $ddlcountry is called

If your controller has this:
PHP Code:
$data['dllcountry'] = 'Some value';
then your view (in this case 'myview.php') is able to use the value of the variable $dllcountry.
In your view:
PHP Code:
<?php echo $dllcountry;?>
will result in 'Some value'.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.