Hi,
I am new to framwork,
Now I started to learn Codeigniter.
I have installed version of CodeIgniter 2.2.6, from the following link
https://codeigniter.com/download
I want to do a simple registration form with image upload , storing that image in a seperate folder, image name in to database, and with validation too.

And I want to know which file has to run first, how to run the files in codeigniter.

How to congfigure when installing ?

Recommended Answers

All 3 Replies

Hi,

CodeIgniter 2.* is in legacy mode and reached end-of-life on October 31, 2015. It means they are not going to support it anymore. It's there for projects already developed under this code, but you should not use it to start new ones, as if a security issue is found, you would have to patch it on your own.

Switch to Codeigniter 3.* and follow their user guide:

There is a tutorial which explains the framework basics.

hi, AntonyRayan its good to go CI 3.x its secure , and firstly you can check out lots of tutorial avaliable for codignitor framework ,you can visit phpeverday.com , and basic code for insert data is this ...
on Controller create file tops.php

<?php // controller class hit url index.php/tops/box/1 
class tops extends CI_Controller {

        function box($num1)//this is call from url
        {
        echo $num1."Welcome in codeignitor";
        ////redirect(tops/blog); // for header() use this redirect()
        $this->load->view('test-view');
        }   
        public function send()
        {
                        $u = $this->input->post('username');
                        $p = $this->input->post('subject');
                        //echo $u . $p ;
                        // you can use for image uploade files option 
                        $this->load->model('model');// its shows model  folder model.php                

                        $data = array("username"=>$u,"subject"=>$p);
                        $this->model->insertdata('reg',$data);

        }
        // you can create file in view folder name blog.php call here through url index.php/file name tops and function name blog
        // open this file index.php/tops/blog/
        public function blog()
        {

        $this->load->view('blog');// view folder file name blog.php
        }

}
?>

model.php

<?php 

class Model extends CI_Model
{

    function insertdata($table,$data)
            {

                $this->db->insert($table,$data);

            }

}

?>// save on models folder under application>models

view.php its save on views folder in application >views

  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <h1>This is view leyer in view folder ....</h1>
    <?php 
    $hidden = array('username' => 'Joe', 'member_id' => '234');

    //echo form_open();
    echo form_open_multipart('tops/send', '', $hidden); ?>
    <table align="center" border="1">
    <tr>
        <td>Name:</td>
        <td><?php 
        $data = array( 'name'        => 'username',
                  'id'          => 'username',
                  'value'       => '',
                  'placeholder' =>'Please Enter User Name....',
                  'maxlength'   => '100',
                  'size'        => '50',
                  'style'       => 'width:50%');
        echo form_input($data);?></td>
    </tr>
    <tr>
        <td>Subject:</td>
        <td><?php
        $data = array( 'name'        => 'subject',
                  'id'          => 'username',
                  'value'       => '',
                  'placeholder' =>'Please Enter Subject....',
                  'maxlength'   => '100',
                  'size'        => '50',
                  'style'       => 'width:50%');


         echo form_input($data);?></td>
    </tr>
    <tr>
        <td>Password:</td>
        <td><?php echo form_password();?></td>
    </tr>
    <tr>
        <td>Comment:</td>
        <td><?php echo form_textarea();?></td>
    </tr>
    <tr>
        <td>Comment:</td>
        <td><?php 
        $data = array( 'name'        => 'submit',
                  'id'          => 'submit',
                  'value'       => 'submit',
                  'style'       => 'width:50%');

         echo form_submit($data);?></td>
    </tr>

    </table>
    </body>
    </html>
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.