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

Hi guys! I am new in CodeIgniter and I have one probably simple question. I tried google it but I couldn't found right answer or I just didn't new how to usi it in my code.

So, what I want is that from prisijungus.php (this is from my native language) form_input set variable that I could use in other view file.

This is my view file prisijungus.php:
PHP Code:
<?php
    
    
echo form_open('myassets/login_validation');
    
    echo 
validation_errors();
    
    echo 
"<p>El. pa&#353tas: ";
    echo 
"<br>";
    echo 
form_input('email'$this->input->post('email'));
    echo 
"</p>";
    
    echo 
"<p>Slapta&#382odis: ";
    echo 
"<br>";
    echo 
form_password('password');
    echo 
"</p>";
    
    echo 
"<p>";
    echo 
form_submit('login_submit''Prisijungti');
    echo 
"</p>";
    
    echo 
form_close();
    
    
    
?>

In other view file I will just echo variable.

I hope you understand what I want, sorry for bad english and thanks for reply's!
Reply
#2

There are several ways of doing this.

1) Use a session variable.

2) CI way: Makes them global to all views.
PHP Code:
$data['your_variable'] = 'your_variable';
$this->load->vars($data); 

3) Find a good Registry Class and store them in it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3
Big Grin 

You can't use it like this way, you have to make that variable "GLOBAl". Please browse the net to make variable in CI.

I give a hint, that it will be done in the MY_Controller.php file,I hope you extend the CI_Controller in the core folder.
Rolleyes
Reply




Theme © iAndrew 2016 - Forum software by © MyBB