Welcome Guest, Not a member yet? Register   Sign In
Passing the variable to view from another view
#1

[eluser]Martin_new[/eluser]
>> My controllerv - verifyregistration

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class verifyregistration extends CI_Controller {

function __construct()
{
    parent::__construct();
    $this->load->model('users_model','',TRUE);
    $this->load->library('email');
}

function index()
{
    //This method will have the credentials validation
    $this->load->library('form_validation');

    $this->form_validation->set_rules('Login', 'Login', 'trim|required|xss_clean|callback_check_database|min_length[6]|strtolower|callback_username_not_exists');
    $this->form_validation->set_rules('Haslo', 'Haslo', 'trim|required|xss_clean|min_length[6]');
    $this->form_validation->set_rules('Powtorz_Haslo', 'Powtorz haslo', 'trim|required|xss_clean|matches[Haslo]|min_length[6]');
    $this->form_validation->set_rules('Imie', 'Imie', 'trim|required|xss_clean|min_length[2]');
    $this->form_validation->set_rules('Nazwisko', 'Nazwisko', 'trim|required|xss_clean');
    $this->form_validation->set_rules('Email', 'Email', 'trim|required|xss_clean|valid_email|min_length[6]');
    $this->form_validation->set_rules('Data_urodzenia', 'Data urodzenia', 'trim|required|xss_clean');
    $this->form_validation->set_rules('Telefon', 'Telefon', 'trim|required|xss_clean|min_length[8]');
    $this->form_validation->set_rules('Miasto', 'Miasto', 'trim|required|xss_clean');
    $this->form_validation->set_rules('Ulica', 'Ulica', 'trim|required|xss_clean|min_length[6]');
    $this->form_validation->set_rules('Kod_pocztowy', 'Kod pocztowy', 'trim|required|xss_clean');
    $this->form_validation->set_error_delimiters('<span>', '</span>');
    $this->form_validation->set_error_delimiters('<li>', '</li>');
    $data['heading'] = "My Real Heading";  

    if($this->form_validation->run() == FALSE)
    {
        $this->load->view('register/register_open',$data);
    }
    else
    {
        return false;  //this is not important
    }
}
>> My view open - register_open, this file is in view folder
Code:
&lt;?php
$this->load->view('mains/header');
$this->load->view('login/loggin');
$this->load->view('mains/menu');
$this->load->view('left_column/left_column_before');
$this->load->view('left_column/menu_left');
$this->load->view('left_column/left_column');
$this->load->view('center/center_column_before');
$this->load->view('register/register_view',$data);
$this->load->view('center/center_column');
$this->load->view('right_column/right_column_before');
$this->load->view('right_column/right_column');
$this->load->view('mains/footer');
?&gt;

>>My view - register_view

Code:
&lt;?php echo form_open('verifyregistration/index'); ?&gt;
    &lt;form&gt;
        <label for="username">Login:</label>
        &lt;input type="text" size="25" id="Login" name="Login" set_value='Login' /&gt;
        .
        .
        .

        <legend>
            &lt;input type="checkbox" id="regulamin" name="Regulamin" /&gt;
            Akceptuję regulamin serwisu. </legend>

            <label>&nbsp;</label>
            &lt;input type="submit" name="Wyslij" value="Wyslij" disabled="disabled"/&gt;
            <label>&nbsp;</label>

        <legend>
            <&lt;?php echo $heading;?&gt;
        </legend>
    &lt;/form&gt;


And I have errors:

Severity: Notice Message: Undefined variable: data Filename: register/register_open.php Line Number: 9 this line-> $this->load->view('register/register_view',$data);

Severity: Notice Message: Undefined variable: heading Filename: register/register_view.php Line Number: 48 this line-> <&lt;?php echo $heading;?&gt;

How I can pass the data to another view?


Messages In This Thread
Passing the variable to view from another view - by El Forum - 10-26-2012, 02:44 AM
Passing the variable to view from another view - by El Forum - 10-26-2012, 03:11 AM
Passing the variable to view from another view - by El Forum - 10-26-2012, 03:23 AM
Passing the variable to view from another view - by El Forum - 10-26-2012, 05:04 AM
Passing the variable to view from another view - by El Forum - 10-26-2012, 05:32 AM
Passing the variable to view from another view - by El Forum - 10-26-2012, 08:25 AM
Passing the variable to view from another view - by El Forum - 10-26-2012, 08:59 AM
Passing the variable to view from another view - by El Forum - 10-26-2012, 11:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB