Data does not save and not displaying any error - Codeigniter

Irene

The data doesn't save without prompting any errors in my code

Here is my code in my Controller

function saveDebit(){
$jevseries=$this->input->post('series');
$account='debit';
$count='1';
$this->form_validation->set_error_delimiters('<div class="error">', '</div>'); 
$this->form_validation->set_rules('accountName', 'Account Name', 'required');
$this->form_validation->set_rules('amountDebit', 'Amount', 'required|numeric');

$this->formValidation();
    if ($this->form_validation->run() == FALSE) {
        $this->entryAccount($jevseries);
        } else {
          $debitData = array(
            'Series' => $jevseries,
            'AccountCode' => $this->input->post('accountName'),
            'Account' => $account,
            'Amount' => $this->input->post('amountDebit'),
            'Count' => $count);

      $this->Jev_model->entryDebit($debitData);
    }

}

Model

 function entryDebit($debitData){
    $this->db->insert('generalaccount', $debitData);
}

This is my View

<?php echo form_open('Jev/saveDebit'); ?>
        <table class="jev_entry" id="jev_entry">
            <tr>
                <td>Debit</td>
                <?php echo form_hidden('series', $series);?>
                <td><?php
                 $account_array = array();
                 foreach($accountNames as $account ){
                     $account_array []= $account->accountName;
                 }

                 echo form_dropdown('accountName',  $account_array,'', 'class="form-control"');

                 ?></td>
            </tr>
            <tr>
                <td>Amount</td>
                <td><?php  echo form_input('amountDebit','', 'class="form-control"');?><div class="error"><?php echo form_error('amountDebit'); ?></div></td>
            </tr>
            <tr>
                <td></td>
                <td align="center"><?php echo '<center>'. form_submit('submit','Save').'</center>'; ?> </td>
            </tr>
        </table>

I don't know where is the error in this lines.. Your help is very much appreciated.

Lorenzo

Okay i have found out what is wrong, The form_input of codeigniter only gives the form with a label. It does not give a name therefore we cannot post it since it doesn't have a name. Do this :)

$data = array(
        'name'          => 'username',
        'id'            => 'username',
        'value'         => 'johndoe',
        'maxlength'     => '100',
        'size'          => '50',
        'style'         => 'width:50%'
);

echo form_input($data);

It's like that and we post the name. Of course you can remove some parameters. More info in the form helper user guide in codeigniter :)

Godluck meyt

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Core Data update does not save and does not give any error, why?

From Dev

DataGridTextColumn not displaying any data

From Dev

The code is not showing any error but still not displaying data on the datagrid of webform.?

From Dev

Codeigniter file upload displaying error

From Dev

context.SaveChanges does not save changes without any error

From Dev

Hibernate does not save Object even not getting any error in log

From Dev

Xamarin ListView not displaying any data

From Dev

Displaying data from database with AJAX, jquery and codeigniter

From Dev

Displaying data from database with AJAX, jquery and codeigniter

From Dev

Displaying Data from a Join in Codeigniter 2.2.1

From Dev

Displaying heirarchical data with Codeigniter closure table

From Dev

Does Spring Data JPA crudrepository save method have any return value? If so what does it returns?

From Dev

kibana error in displaying some data

From Dev

Php error displaying data in input

From Dev

JSON parsing error, data not displaying

From Dev

Laravel Error with displaying data correctly

From Dev

Why isn't the XSL displaying any data

From Dev

ng-grid is not displaying any data

From Dev

file_get_contents not displaying any data

From Dev

Azure activity logs not displaying any write data

From Dev

Codeigniter Error Input data

From Dev

Validation error: Data does not match any schemas from 'oneOf'

From Dev

Swagger error | Data does not match any schemas from 'oneOf'

From Dev

MagicalRecord does not save data

From Dev

multiprocessing does not save data

From Dev

How to save and extract session data in codeigniter

From Dev

Save() is not updating data in table in datamapper with codeigniter

From Dev

Codeigniter calendar not displaying correct data and set limit not working

From Dev

CodeIgniter: Displaying data from two tables in a view - use one loop?

Related Related

  1. 1

    Core Data update does not save and does not give any error, why?

  2. 2

    DataGridTextColumn not displaying any data

  3. 3

    The code is not showing any error but still not displaying data on the datagrid of webform.?

  4. 4

    Codeigniter file upload displaying error

  5. 5

    context.SaveChanges does not save changes without any error

  6. 6

    Hibernate does not save Object even not getting any error in log

  7. 7

    Xamarin ListView not displaying any data

  8. 8

    Displaying data from database with AJAX, jquery and codeigniter

  9. 9

    Displaying data from database with AJAX, jquery and codeigniter

  10. 10

    Displaying Data from a Join in Codeigniter 2.2.1

  11. 11

    Displaying heirarchical data with Codeigniter closure table

  12. 12

    Does Spring Data JPA crudrepository save method have any return value? If so what does it returns?

  13. 13

    kibana error in displaying some data

  14. 14

    Php error displaying data in input

  15. 15

    JSON parsing error, data not displaying

  16. 16

    Laravel Error with displaying data correctly

  17. 17

    Why isn't the XSL displaying any data

  18. 18

    ng-grid is not displaying any data

  19. 19

    file_get_contents not displaying any data

  20. 20

    Azure activity logs not displaying any write data

  21. 21

    Codeigniter Error Input data

  22. 22

    Validation error: Data does not match any schemas from 'oneOf'

  23. 23

    Swagger error | Data does not match any schemas from 'oneOf'

  24. 24

    MagicalRecord does not save data

  25. 25

    multiprocessing does not save data

  26. 26

    How to save and extract session data in codeigniter

  27. 27

    Save() is not updating data in table in datamapper with codeigniter

  28. 28

    Codeigniter calendar not displaying correct data and set limit not working

  29. 29

    CodeIgniter: Displaying data from two tables in a view - use one loop?

HotTag

Archive