3.Creating a link

Easy Steps:

1.     On your notepad++, edit the home_view.php in C:\xampp\htdocs\application\views and type the following:
<html>
<head>
<title>Home | BizjobFinder</title>
</head>
<body>
<h2>Welcome to BizjobFinder Home Page.</h2>
<div>
            <a href="<?php echo base_url()?>jobseeker-signup">Jobseeker Signup</a>
</div>
</body>
</html>

2.     Open config.php located on: C:\xampp\htdocs\application\config, and edit it.
$config['base_url']   = 'http://localhost/';

3.     Open autoload.php located on: C:\xampp\htdocs\application\config, and edit it.
$autoload['helper'] = array('url');

4.     Create another file named jobseeker_signup_view.php, save it to: C:\xampp\htdocs\application\views and type the following:
<html>
<head>
      <title>Jobseeker Signup | BizjobFinder</title>
      <link href='<?php echo base_url()?>css/style.css' rel='stylesheet' type='text/css'></link>
</head>
<body>
<div><h4>Free Signup</h4></div>
<hr>
      <form>
      <div>

                  <div class='form-row'>
                              <span class='label'>Firstname:</span>
                              <input type='text' name='firstname'/>
                  </div>
                  <div class='form-row'>
                              <span class='label'>MI:</span>
                              <input type='text' name='mi'/>
                  </div>
                  <div class='form-row'>
                              <span class='label'>Lastname:</span>
                              <input type='text' name='lastname'/>
                  </div>
                  <div class='form-row'>
                              <span class='label'>Street/Barangay:</span>
                              <input type='text' name='street_barangay'/>
                  </div>
                  <div class='form-row'>
                              <span class='label'>Town/City:</span>
                              <input type='text' name='town_city'/>
                  </div>
                  <div class='form-row'>
                              <span class='label'>Province:</span>
                              <input type='text' name='province'/>
                  </div>
                  <div class='form-row'>
                              <span class='label'>&nbsp;</span>
                              <input type='submit' name='submit' value='Register'/>
                  </div>
            </form>
        </body>
          </html>

5.     Create folder named css on: C:\xampp\htdocs. Inside css folder create a file named style.css and type the following:
.form-row{
      padding:5px;
      }
.label{
      display:block;
      width:110px;
      float:left;
      text-align:right;
      margin-right:5px;
      }

6.      Create another file named jobseekes.php, save it to: C:\xampp\htdocs\application\controllers and type the following:
<?php
/*
 *Filename:jobseekers.php
 *Projectname:Bizjobfinder.com
 *Date Created: April 02, 2012 @5:20pm
 *Created by: Mario T. Silvano a.k.a strikermode
*/
if( !defined('BASEPATH') ) exit ('No direct script access allowed');

class jobseekers extends CI_Controller{

      function __construct(){
                  parent::__construct();
      }
      function signup(){
                  $this->load->view('jobseeker_signup_view');
      }
}
/*
End of file jobseekers.php
Location:./application/controllers/jobseekers.php
*/

7.     Open routes.php located on: C:\xampp\htdocs\application\config, and edit it.
$route['jobseeker-signup']="jobseekers/signup";

8.     Copy .htaccess on C:\xampp\htdocs\application and paste it to C:\xampp\htdocs and edit it by typing the following:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|css)
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

9.     Let us put your code to the test, type localhost on your browser and you will see like this:

10.  Click the link Jobseeker Signup and you will see like this:
11.  Nice jobJ

3 comments:

  1. sir, just want to make a comment on the typo error on step 6 on the filename "jobseekes.php" which should be "jobseekers.php"

    ReplyDelete
  2. For some reason the .htaccess code on step 8 didn't for me as I have created in /htdocs a /ci folder where my /application and other files are. It worked though using this .htaccess code below;

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php/$0 [PT,L]

    ReplyDelete