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

  • SEARCH
  • Home
  • 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 7944881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:41:05+00:00 2026-06-04T00:41:05+00:00

I have a signup form where I’m validating user input. Here’s my controller: <?php

  • 0

I have a signup form where I’m validating user input. Here’s my controller:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Register extends CI_Controller {

    public function index()
    {
        $this->load->model('Users_model');
        $this->load->helper('form');
        $this->load->library('form_validation');

        $data['page_title'] = 'Register';
        $this->load->view('header', $data);

        // Set form validation rules
        $this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[16]|xss_clean|callback_username_check');
        $this->form_validation->set_rules('email', 'Email', 'trim|required|min_length[5]|max_length[64]|valid_email|callback_email_check');
        $this->form_validation->set_rules('password', 'Password', 'required');
        $this->form_validation->set_error_delimiters('<span class="error">', '</span>');

        if ($this->form_validation->run() == FALSE)
        {
            $this->load->view('register', $data);
        }
        else
        {
            // Add the user to the database
            $this->Users_model->add_user();
            $this->load->view('register_success', $data);
        }

        $this->load->view('footer', $data);
    }

    /* Functions to check username and email */
}

/* End of file register.php */
/* Location: ./application/controllers/register.php */

The problem is with this line: $this->Users_model->add_user();. I want to pass the username, email and password to my Users model to add the user to my database, but I’m not sure how I can get the POST data into that method. Normally I’d use $_POST['username'] etc but CodeIgniter has run some functions on the input values (trim(), xss_clean etc). How can I get these values and pass them into my add_user() method?

  • 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-04T00:41:08+00:00Added an answer on June 4, 2026 at 12:41 am

    The CodeIgniter input class allows you to get the POST data after it has been filtered by the form validation library. In your controller you would do the following:

    $username = $this->input->post('username');
    $email = $this->input->post('email');
    $password = $this->input->post('password');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form (signup.php) that pops up in a nyroModal window when I
I have a form allowing a user to signup for a news letter which
Simple scenario: I have a signup form, with user name, password, email address, may
I have recaptcha on my signup form. The user must type something in the
I have a signup form of which most fields are pre-filled using user's Facebook
I have a user signup form, and I need to insert a function to
I have a simple user signup form with a checkbox that lets users get
I have made a user signup form in asp.net. I want to check the
I have a php signup form. I have a text field named username ie,
I have signup form that posts all variables to signup.php. What I want to

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.