Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter, Message: Undefined variable, Passing data
    text
    copied!<p><strong>>> My controllerv - verifyregistration</strong></p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class verifyregistration extends CI_Controller { function __construct() { parent::__construct(); $this-&gt;load-&gt;model('users_model','',TRUE); $this-&gt;load-&gt;library('email'); } function index() { //This method will have the credentials validation $this-&gt;load-&gt;library('form_validation'); $this-&gt;form_validation-&gt;set_rules('Login', 'Login', 'trim|required|xss_clean|callback_check_database|min_length[6]|strtolower|callback_username_not_exists'); $this-&gt;form_validation-&gt;set_rules('Haslo', 'Haslo', 'trim|required|xss_clean|min_length[6]'); $this-&gt;form_validation-&gt;set_rules('Powtorz_Haslo', 'Powtorz haslo', 'trim|required|xss_clean|matches[Haslo]|min_length[6]'); $this-&gt;form_validation-&gt;set_rules('Imie', 'Imie', 'trim|required|xss_clean|min_length[2]'); $this-&gt;form_validation-&gt;set_rules('Nazwisko', 'Nazwisko', 'trim|required|xss_clean'); $this-&gt;form_validation-&gt;set_rules('Email', 'Email', 'trim|required|xss_clean|valid_email|min_length[6]'); $this-&gt;form_validation-&gt;set_rules('Data_urodzenia', 'Data urodzenia', 'trim|required|xss_clean'); $this-&gt;form_validation-&gt;set_rules('Telefon', 'Telefon', 'trim|required|xss_clean|min_length[8]'); $this-&gt;form_validation-&gt;set_rules('Miasto', 'Miasto', 'trim|required|xss_clean'); $this-&gt;form_validation-&gt;set_rules('Ulica', 'Ulica', 'trim|required|xss_clean|min_length[6]'); $this-&gt;form_validation-&gt;set_rules('Kod_pocztowy', 'Kod pocztowy', 'trim|required|xss_clean'); $this-&gt;form_validation-&gt;set_error_delimiters('&lt;span style="color: red; font-size: 12px; ; line-height: 14px; "&gt;', '&lt;/span&gt;'); $this-&gt;form_validation-&gt;set_error_delimiters('&lt;li&gt;', '&lt;/li&gt;'); $data['heading'] = "My Real Heading"; if($this-&gt;form_validation-&gt;run() == FALSE) { $this-&gt;load-&gt;view('register/register_open',$data); } else { return false; //this is not important } } </code></pre> <p><strong>>> My view open - register_open</strong></p> <pre><code>&lt;?php $this-&gt;load-&gt;view('mains/header'); $this-&gt;load-&gt;view('login/loggin'); $this-&gt;load-&gt;view('mains/menu'); $this-&gt;load-&gt;view('left_column/left_column_before'); $this-&gt;load-&gt;view('left_column/menu_left'); $this-&gt;load-&gt;view('left_column/left_column'); $this-&gt;load-&gt;view('center/center_column_before'); $this-&gt;load-&gt;view('register/register_view',$data); $this-&gt;load-&gt;view('center/center_column'); $this-&gt;load-&gt;view('right_column/right_column_before'); $this-&gt;load-&gt;view('right_column/right_column'); $this-&gt;load-&gt;view('mains/footer'); ?&gt; </code></pre> <p><strong>>>My view - register_view</strong> </p> <pre><code>&lt;?php echo form_open('verifyregistration/index'); ?&gt; &lt;form&gt; &lt;label for="username"&gt;Login:&lt;/label&gt; &lt;input type="text" size="25" id="Login" name="Login" set_value='Login' /&gt; . . . &lt;legend&gt; &lt;input type="checkbox" id="regulamin" name="Regulamin" onclick="this.form.elements['Wyslij'].disabled = !this.checked" /&gt; Akceptuję regulamin serwisu. &lt;/legend&gt; &lt;label&gt;&amp;nbsp;&lt;/label&gt; &lt;input type="submit" name="Wyslij" value="Wyslij" disabled="disabled"/&gt; &lt;label&gt;&amp;nbsp;&lt;/label&gt; &lt;legend&gt; &lt;&lt;?php echo $heading;?&gt; &lt;/legend&gt; &lt;/form&gt; </code></pre> <p>And I have errors:</p> <p>Severity: Notice Message: Undefined variable: data Filename: register/register_open.php Line Number: 9 this line-> <code>$this-&gt;load-&gt;view('register/register_view',$data);</code></p> <p>Severity: Notice Message: Undefined variable: heading Filename: register/register_view.php Line Number: 48 this line-> <code>&lt;&lt;?php echo $heading;?&gt;</code></p> <p>How I can pass the data to another view?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload