Welcome Guest, Not a member yet? Register   Sign In
store information to the database
#1
Smile 

Hello,

I am trying to fix this input form so that it could capture information and store it in the database.  Yet, even after filling this information and press enter it still does not moves to the database I wonder why?


Gionda CMS


Pages

create_date
pages_name
pages_order



Pages Name: Home
Create Date: 552016
Order: 5
Content: Lorem Ipsum

------------------------------------

Thank you for filling the information. It has been successful.

Pages Name: Home
Create Date: 552016
Order: 5
Content: Lorem Ipsum


-------------------------------




views/add_pages.php

PHP Code:
<form action="submitpages" method="post">
                        
                        <
table border="0" style="width: 100%; height: 90px;">
                            <
tr>
                                <
td>Pages Name:</td>
                                <
td><input type="input" name="pages_name"></td>
                            </
tr>
                            <
tr>
                                <
td>Create Date:</td>
                                <
td><input type="input" name="create_date" size="2"></td>
                         
   </tr>
                            <
tr>
                                <
td>Order:</td>
                                <
td><input type="input" name="pages_order" size="4"></td>
                         
   </tr>
                            <
tr>
                                <
td>View Content:</td>
                                <
td><textarea cols="150px" rows="5px" name="pages_content"></textarea></td>
                         
   </tr>
                            <
tr>
                                <
td></td>
                                <
td><input type="submit" name="submit" value="Submit" /></td>
                         
   </tr>    
                        </
table>            
                        
                        </
form



controllers/cpages.php

PHP Code:
    public function addpages() 
    { 
 
        
        $this
->load->model('pages_model');
        
$this->load->helper('url_helper');    

        
$this->form_validation->set_rules('pages_name''pages_name''required');
        
$this->form_validation->set_rules('create_date''create_date''required');
        
$this->form_validation->set_rules('pages_order''pages_order''required');
        
$this->form_validation->set_rules('pages_content''pages_order''required');
        
                
                
            if (
$this->form_validation->run() === FALSE)
            {
            
$this->load->view('add_pages');
            }
                
            else
            {
            
$this->pages_model->insert_pages();        
            
$this->load->view('add_pages');                
            }
                        
         
 
    
    
}

    public function submitcontent() {                                    
    
    
            $this
->load->model('insert_pages()');
            $this->load->model('update_pages()');
            
    
            $this
->load->view('submitcontent');
    
    




models/pages_model.php


PHP Code:
public function insert_pages()
 
       {
                
                
$data = array(
                    
'pages_name' => $this->input->post('title'),
                    
'create_date'  => $this->input->post('date'),
                    
'pages_order' => $this->input->post('order'),
                    
'pages_content' => $this->input->post('content')                
                );
            
 
               return $this->db->insert('pages'$data);
 
       }

 
   public function update_pages()
 
       {
 
               $this->title    $_POST['pages_name']; // please read the below note
 
               $this->date     time();
                
$this->order    $_POST['order'];
                
$this->content  $_POST['content'];

 
               $this->db->update('pages'$this, array('id' => $_POST['id']));
 
       
" If I looks more intelligence please increase my reputation."
#2

Why do you start another thread for the same issue?

You have started this thread http://forum.codeigniter.com/thread-65441.html for the same problem.
#3

** DUPLICATE THREAD **




Theme © iAndrew 2016 - Forum software by © MyBB