Welcome Guest, Not a member yet? Register   Sign In
model and database
#11

I gave you the answer, yet you didn't read it?

Look at what your form is posting:

1) pages_name
2) create_date
3) pages_order
4) pages_content

You validate these fields, but then your insert attempts to use the wrong field names:

1) title
2) date
3) order
4) content

Each of the calls to $this->input->post() are returning null, right?
Reply
#12

(This post was last modified: 06-14-2016, 02:07 AM by davy_yg.)

Look at what your form is posting:

1) pages_name
2) create_date
3) pages_order
4) pages_content

You validate these fields, but then your insert attempts to use the wrong field names:

1) title
2) date
3) order
4) content

Each of the calls to $this->input->post() are returning null, right?


I revise this out:

Pages_model.php

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

and in the database nothing stored.

I wonder why?
" If I looks more intelligence please increase my reputation."
Reply
#13

(06-14-2016, 12:58 AM)davy_yg Wrote: Look at what your form is posting:

1) pages_name
2) create_date
3) pages_order
4) pages_content

You validate these fields, but then your insert attempts to use the wrong field names:

1) title
2) date
3) order
4) content

Each of the calls to $this->input->post() are returning null, right?


I revise this out:

Pages_model.php

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

and in the database nothing stored.

I wonder why?
What is your form url??
Keep calm.
Reply
#14

Still offline. Can you help me from the data that I have given to you?
" If I looks more intelligence please increase my reputation."
Reply
#15

(This post was last modified: 06-19-2016, 01:03 AM by davy_yg.)

This is my weblink I already upload it.  Can you help:

http://www.innovation.web.id/Profile/CompanyProfileCI/

Now I have a new error that I do not know how to fix it.

Can anyone help me fix this prob so that I can store data in my database?
" If I looks more intelligence please increase my reputation."
Reply
#16

Hello,

I add this to my codes:

add_pages.php


PHP Code:
<form action="submitpages" method="post">
                        <?
php echo form_open('cpages/addpages'); ?>
                        
                        <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> 



I wonder why it still cannot store data into my database?
" If I looks more intelligence please increase my reputation."
Reply




Theme © iAndrew 2016 - Forum software by © MyBB