CodeIgniter Forums

Full Version: $ result does not show in view
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I am stuck in this bug and I cannot solve it. I read already many times the user guide about form validation but I dont figure it out this problem. Please someone could help me. What I am doing wrong? I am using codeigniter 2.0.

Error: A PHP Error was encountered

Severity: Notice

Message: Undefined variable: result

Filename: views/home.php

My controller: form.php
class Form extends CI_Controller
public function __construct()

public function index()
$data['result'] ='';



$this->form_validation->set_rules('email', 'Email', 'required|valid_email', 'E-mail is not v!');

if ($this->form_validation->run() == FALSE)
$data['result'] = validation_errors();
$this->load->view('home', $data);
$data['result'] = $this->signup_model->create();
$this->load->view('home', $data);

My view: home.php
<form method="post" action="form">
<p class="space">Sign-up: &lt;input type="text" name="email" value="&lt;?php echo set_value('email'); ?&gt;" size="30" /&gt;
&lt;input type="hidden" name="type" value="&lt;?php echo set_value('type'); ?&gt;" size="50" /&gt;
&lt;input type="submit" class="button" value="Submit" /&gt;&lt;/p>
&lt;span>&lt;?php echo $result; ?&gt;</span>

El Forum

Before you submit your code, wrap it with code tags
// Remove the space after 'code' before ']'
[code ]
// your code here
[/code ]
And if you want to ask something which didnt related with CI Bugs, please use another section!