Welcome Guest, Not a member yet? Register   Sign In
User Login Page?
#7

[eluser]ywftdg[/eluser]
Ok, like I said, I am still new, i'm missing some logic in all this. I have been trying to tweak from the lesson in the user guide, but the part with checking the database is doing nothing. I think the values are not being sent to my query or something. I will later move my query to the models, but for right now just have it in the controller. Can anyone lend some advice on what is wrong with this?

Code:
class Form extends Controller {
    
    /////////////////////////////
    function index()    {
    
        $this->load->helper(array('form', 'url'));
        $this->load->library('validation');
        
        
        //Set rules for forms
        $rules['email']     = "trim|required|valid_email";
        $rules['password']    = "required";
        $this->validation->set_rules($rules);
        
    
        //Reset form keeps email entered.
        $fields['email'] = 'Email';
        $fields['password'] = 'Password';
        $this->validation->set_fields($fields);

    
        //check the status
        if ($this->validation->run() == TRUE)    {
            
             $this->db->select('*');
            $this->db->where('designer.dEmail' , '$email');
            $this->db->where('designer.dPassword' , '$password');
            $this->db->from('designer');
            $query = $this->db->get();
            
            if ($query->num_rows() > 0) {
                $this->load->view('formsuccess');
            } else    {
                $this->load->view('myform');
                }
        }
        
        else    {
            $this->load->view('myform');
        }
            
    }

    
    /////////////////////////////
    }


myform.php (view)
Code:
<? $attributes = array('class' => 'accountForm', 'id' => 'form') ?>

    &lt;?=$this->validation->set_error_delimiters('<div><strong>', '</strong></div>')?&gt;
    &lt;?=$this->validation->error_string?&gt;
    
    
    &lt;?=form_open (base_url().'form', $attributes) ?&gt;
    &lt;?=form_hidden ('go', 'true')?&gt;
    
    <div class="accountEntryA">
        <div class="accountLeft">Email</div>
        <div class="accountRight">&lt;?=form_input('email', $this->validation->email)?&gt;</div>
        <div class="clear"></div>
        
        <div class="accountLeft">Password</div>
        <div class="accountRight">&lt;?=form_password('password')?&gt;</div>
        <div class="clear"></div>
    </div>
    
    <div class="accountEntry">
        <div class="accountLeft">&lt;?=form_submit('submit', 'Submit')?&gt;</div>
        <div class="accountRight"></div>
        <div class="clear"></div>
    </div>
    
    &lt;?=form_close()?&gt;


Messages In This Thread
User Login Page? - by El Forum - 07-28-2008, 09:01 AM
User Login Page? - by El Forum - 07-28-2008, 09:52 AM
User Login Page? - by El Forum - 07-28-2008, 11:38 AM
User Login Page? - by El Forum - 07-28-2008, 01:11 PM
User Login Page? - by El Forum - 07-28-2008, 08:23 PM
User Login Page? - by El Forum - 07-28-2008, 09:41 PM
User Login Page? - by El Forum - 07-28-2008, 11:34 PM
User Login Page? - by El Forum - 07-28-2008, 11:53 PM
User Login Page? - by El Forum - 07-29-2008, 09:59 AM
User Login Page? - by El Forum - 07-29-2008, 10:59 AM
User Login Page? - by El Forum - 07-29-2008, 11:24 AM
User Login Page? - by El Forum - 07-29-2008, 09:59 PM
User Login Page? - by El Forum - 07-30-2008, 01:35 AM
User Login Page? - by El Forum - 07-30-2008, 04:25 AM
User Login Page? - by El Forum - 07-30-2008, 05:42 AM
User Login Page? - by El Forum - 07-30-2008, 10:00 PM
User Login Page? - by El Forum - 09-24-2008, 09:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB