Welcome Guest, Not a member yet? Register   Sign In
Help with User Registration Function?
#4

[eluser]Corey Freeman[/eluser]
Okay so I fixed it up a bit and got this:

Code:
<?php

class Register extends Controller {

    function register()
    {
        parent::Controller();
        $this->load->helper('form');
        $this->load->helper('url');    
        $this->load->library('form_validation');
    }
    
    function index()
    {
        $this->load->view('header');
        $this->load->view('buy_now');
        $this->load->view('footer');
    }
    function register_form() {
        $this->form_validation->set_rules('username', 'Username');
        $this->form_validation->set_rules('password', 'Password', 'required|matches[passconf]');
        $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
        if ($this->form_validation->run() == FALSE)
        {
        $this->load->view('header');
        $this->load->view('register_form');
        $this->load->view('footer');        }
        else
        {
            //Register the Player
            $this->register_member();
            //Show the Next Page
            redirect('register/success');
        }
    }
    //
    function register_member() {
            $username = $_POST['username'];
            $password = $_POST['password'];
            $email = $_POST['email'];
            $this->db->insert('players', $_POST);
    }
    //
    function success() {
        $this->load->view('header');
        $this->load->view('register_success');
        $this->load->view('footer');
    }
}

?>

The only thing I'm stuck on now is how to use models, and how to use a model to be able to check whether or not the username and email match any existing ones in the database.


Messages In This Thread
Help with User Registration Function? - by El Forum - 07-02-2010, 06:31 AM
Help with User Registration Function? - by El Forum - 07-02-2010, 07:30 AM
Help with User Registration Function? - by El Forum - 07-02-2010, 08:00 AM
Help with User Registration Function? - by El Forum - 07-02-2010, 11:47 AM
Help with User Registration Function? - by El Forum - 07-02-2010, 12:22 PM
Help with User Registration Function? - by El Forum - 07-02-2010, 12:23 PM
Help with User Registration Function? - by El Forum - 07-02-2010, 02:46 PM
Help with User Registration Function? - by El Forum - 07-02-2010, 02:51 PM
Help with User Registration Function? - by El Forum - 07-02-2010, 04:20 PM
Help with User Registration Function? - by El Forum - 07-02-2010, 06:36 PM
Help with User Registration Function? - by El Forum - 07-03-2010, 03:29 AM
Help with User Registration Function? - by El Forum - 07-03-2010, 06:29 AM
Help with User Registration Function? - by El Forum - 07-04-2010, 06:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB