`**

login form

Hello Guys, am actually working on a website...
I want a login on the top left corner...login..then when the user click on this ..a modal form would appear asking them for their user-name & password..
I have a already do the login form

controller

    ?php
    function index()
    {
    $data['main_content'] ='login_form';
    $this->load->view('includes/template', $data);
    }
    function validate_credentials()
    {
    $this->load->model('Employee_model');
    $query = $this->Employee_model->validate();
    if($query) // if the user's credentials validated...
    {
    $data = array(
    'username' => $this->input->post('Username'),
    'is_logged_in' => true
    );
    $this->session->set_userdata($data);
    redirect('site/members_area');
    }
    else // incorrect username or password
    {
    $this->index();
    }
    }
    function logout()
    {
    $this->session->sess_destroy();
    $this->index();
    }
    }
    *model*
    <?php
    class Employee_model extends CI_Model {
    function validate()
    {
    $this->db->where('username', $this->input->post('Username'));
    $this->db->where('password', md5($this->input->post('Password')));
    $query = $this->db->get('employee');
    if($query->num_rows == 1)
    {
    return true;
    }
    }
    function register_employee($Type_ID, $First_Name, $Last_Name, $Gender, $Date_of_Birth, $Street, $Town, $Home, $Mobile, $Email_Address, $Job_Title, $Username, $Password, $Confirm_Password)
    {
    $query_str = "INSERT INTO employee(Type_ID, First_Name, Last_Name, Gender, Date_Of_Birth, Street, Town, Home, Mobile, Email_Address, Job_Title, Username, Password, Confirm_Password) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ;
    $this->db->query($query_str,array($Type_ID, $First_Name, $Last_Name, $Gender, $Date_of_Birth, $Street, $Town, $Home, $Mobile, $Email_Address, $Job_Title, $Username, $Password, $Confirm_Password));
    }
    *view*
    Login_area
    </div>
    <h2>Welcome Back, <?php echo $this->session->userdata('username'); ?>!</h2>
    <p>This section represents the area that only logged in employers can access.</p>
    <h4><?php echo anchor('login/logout', 'Logout'); ?></h4>
    </div>
    Login_form.php
    <div id="login_form">
    <h1>Log in !</h1>
    <?php
    echo form_open('login/validate_credentials');
    echo form_input('Username', 'Username');
    echo form_password('Password', 'Password');
    echo form_submit('submit', 'Login');
    echo form_close();
    ?>
    </div>

Please guys help me...to display like a modal form on top...
Inline Code Example Here

**`

Member Avatar for LastMitch

I want a login on the top left corner...login..then when the user click on this ..a modal form would appear asking them for their user-name & password..

I got no idea what you are doing?

I think you forgot to mention that you are using Codeigniter.

Plus you have to understand that no one will write a code for you.

You can take a look at this :

http://www.od2dev.be/codeigniter-form-with-ajax/

thank you..:)..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.