• We just launched and are currently in beta. Join us as we build and grow the community.

How I build User Registration and Form Validation Using CodeIgniter

MrBaum77

Anime Event Coordinator
M Rep
0
0
0
Rep
0
M Vouches
0
0
0
Vouches
0
Posts
63
Likes
140
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 500 XP
The following is an important note in building a User Registration and Form Validation Using CodeIgniter.

routes.php

There are two lines that were change/added as follows:

  1. $route

    [

    'default_controller'

    ]

    =

    "register"

    ;
  2. $route

    [

    'success'

    ]

    =

    "register/success"

    ;

autoload.php

On line 55 we have added database and session to load automatically. This means that you do not need to call it in your controller.

$autoload

[

'libraries'

]

=

array

(

'database'

,

'session'

)

;

config.php

There were only two lines of code that were changed here.
At line 17:

$config

[

'base_url'

]

=

'http://localhost/CI/'

;

At line 227:

$config

[

'encryption_key'

]

=

'0rGBISBT61k7453Ooq6343KjtGe9Xjv4'

;

To generate a random key of your own please visit Random Keygen.

database.php

The last configuration is the database.

Don’t forget to change the following as follows:
  1. $db

    [

    'default'

    ]

    [

    'hostname'

    ]

    =

    'localhost'

    ;
  2. $db

    [

    'default'

    ]

    [

    'username'

    ]

    =

    'root'

    ;
  3. $db

    [

    'default'

    ]

    [

    'password'

    ]

    =

    ''

    ;
  4. $db

    [

    'default'

    ]

    [

    'database'

    ]

    =

    'ci_tutorial'

    ;

Then we have added the following files according to the folder it belongs:

controller/register.php
helpers/registration_helper.php
models/register_model.php
views/register.php
views/success.php

Take note that you do not need to touch any code that is not under the application’s folder. That is, don’t modify any file under system’s folder.

CodeIgniter is a PHP framework and is maintained by the developer. Any modification to the system’s folder will be overwritten if you forgot to backup it when you upgrade to the latest version.

Book traversal links for How I build User Registration and Form Validation Using CodeIgniter

  • ‹ Getting Started With CodeIgniter
  • Up
  • How to Display Error Message in CodeIgniter ›

 

442,401

317,942

317,951

Top