Welcome Guest, Not a member yet? Register   Sign In
Unable to access value from controller to view..
#1

Hi,
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.


Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: ddlcountry

Filename: views/register.php

Line Number: 59

Backtrace:

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
Reply
#2

Paste your code from controller and view Wink
Reply
#3

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,

Paul.
Reply
#4

(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
Reply
#5

If your controller has this:
PHP Code:
$data['dllcountry'] = 'Some value';
$this->load->view('myview',$data); 
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'.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB