Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8200231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:22:16+00:00 2026-06-07T06:22:16+00:00

Update: It is solved .. For some reason, the data is not getting inserted

  • 0

Update: It is solved ..

For some reason, the data is not getting inserted into the table. It is however being posted from the form as I could see with var dump, but further than that, won’t do. So, here are the 3 modules. It is a very simple test scheme: Just a form with two fields, you press Submit and should be inserted. (I can do all that in ordinary PHP with one page, but, the MVC frameworks are a nightmare in this regard, you write about 30 times more code than you would need in procedural.

<?php

class Inserting_controller extends CI_Controller {

     public function __construct()
       {
            parent::__construct();
            $this->load->model('Inserting_model');

       }


     public function index ()
     {

        $this->load->view('inserting_view'); 
     }

    // Controller
     public function insert()
     {
     $data = array(
        'username' => $this->input->post('username', TRUE),
        'password' => sha1($this->input->post('password', TRUE)
     ));


     var_dump($data); // We do get the data posted
      exit;

     $this->Inserting_model->insertdata($data); // this should forward them to the Model
}
}
?>

==============
MODEL

    <?php


    class Inserting_model extends CI_Model{


        function __construct()
        {
            // Call the Model constructor
            parent::__construct();
            $this->load->database();
        }


            public function insertdata($data)
                {
                 $this->db->insert('users', $data);
                } 


    }

    ?>

========
VIEW



    <div id="inserting_form">

            <?php echo form_open('index.php/Inserting_controller/insert/'); ?> 

          <ul>

                <li>



                <label>Username</label>      

                <div><?php echo form_input(array('id' => 'username', 'name' => 'username')); ?></div>

               </li>
               <li>
                <label>Password</label>      

                <div><?php echo form_password(array('id' => 'password', 'name' => 'password')); ?></div>   
                </li>   

                <li><?php echo validation_errors();?></li>

                <li><?php echo form_submit(array('name' =>'submit'),'Insert');?> </li>

          </ul>

          <?php echo form_close(); ?>

            </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:22:18+00:00Added an answer on June 7, 2026 at 6:22 am

    Blushing :/

    On writing the debugging code, I forgot to delete the exit; thus, the program exited right after that ….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
update SOLVED - the problem is not with my code. there is a design
Updated Problem solved, I have some design problem here. The directory looks like that:
UPDATE: SOLVED Hi all, i've got it, just save cookie to temp file, and
Update 7/17 SOLVED I've updated my code to the Solved version. Original Question I'm
UPDATE: First problem solved, second one described at the bottom of this post. UPDATE2:
Update II Problem Solved but Why? This has been the biggest headache ever. My
UPDATE The issue is solved, all the code you can see works. Hello! I
[Update] Unfortunately I never had an opportunity to solve this problem. However, there are
The problem is not solved although I accepted one answer. Problem: Vim updates very

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.