Welcome Guest, Not a member yet? Register   Sign In
$ result does not shows in my view!!! HELP!!!
#11

[eluser]Luis ACE[/eluser]
Here is my code, I dont have your signup_model. I excluded it in my code.

Form Controller

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

class Form extends CI_Controller {

    public function __construct()
      {
            parent::__construct();
      }

    public function index()
    {
        $data = array();
        
        $this->load->library('form_validation');

        $this->load->database();    
        
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email', 'E-mail is not valid!');
        
        if ($this->form_validation->run() == FALSE)
        {
            $data['result'] = validation_errors();
        }
        else
        {
            $data['result'] = 'Successful.';
        }
        
        $this->load->view('home', $data);
    }
}

your View

Code:
<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;/form&gt;
<span>&lt;?php if(isset($result)) echo $result; ?&gt;</span>

See if that works.
#12

[eluser]Bacu[/eluser]
oh! Thank you very much! It works now!
All the best!
Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB