The document describes a flower catalog application built with CodeIgniter. It includes:
1) A FlowerController class with methods to view, insert, and save flowers to a database.
2) FlowerModel class to retrieve flower data from the database.
3) Views to display flower listings, a single flower, and an insert form.
4) The application retrieves flower data from a database table and allows users to view listings, individual flowers, and insert new flowers which are then saved to the database.
2. /application/controllers/FlowerController.php
<?php
class FlowerController extends CI_Controller {
function __Construct(){
parent::__Construct ();
$this->load->model('FlowerModel','f'); // load model
}
public function index() {
$this->load->view('flowers_view');
}
public function view($id=NULL){
$row=$this->f->getFlower($id);
$data['r']=$row;
$this->load->view('single_flower_view',$data);
}
3. public function insert(){
$this->load->view('insert_view');
}
public function save(){
//create array with input data
$data=array(
'nume'=>$this->input->post('nume'),
'culoare'=>$this->input->post('culoare'),
'marime'=>$this->input->post('marime'),
'pret'=>$this->input->post('pret'),
);
//insert data
$this->db->insert('flori',$data);
//redirect
redirect('FlowerController/index');
}
}