0

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 ?

Edited by AntonyRayan

3
Contributors
3
Replies
10
Views
1 Year
Discussion Span
Last Post by Nishant shukla1
2

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.

Edited by cereal

0

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

Edited by Nishant shukla1: more code added

0

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>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.