• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
$ result does not show in view

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 vhttp://ellislab.com/forums/newtopic/51/alid!');

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>

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!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.