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 7627209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:25:45+00:00 2026-05-31T05:25:45+00:00

I have a model register.php (under app/model/register.php) <?PHP // Load the [default] db group

  • 0

I have a model register.php (under app/model/register.php)

<?PHP

// Load the [default] db group
$this->load->database();

// Get Input from init form, sanitize, plop into variables.
class Register extends Model{

    function formModel(){
    //load parent constructor
    parent::Model();
    }

    function sanitizeInput(){
        var $name = mysql_real_escape_string($_POST['fullname']);
        var $email = mysql_real_escape_string($_POST['email']);
        var $pass = mysql_real_escape_string($_POST['password']);
        var $dySalt = mt_rand(20,100); 
        var $pass = hash('sha512',$dySalt.$pass);
    }

    // Set form variables into object; define db table
    $registeredObject = new getSanitizeNewRegistrant();
    $tbl = 'Fan';

    function SendRequestForData(){
        if{
        $this->db->insert($tbl,$object);
        // .. redirect()
        echo "Sent";
        }
        else{
        echo "Oops, could not register you";
        }
    }



}
?>

I’m loading this model into a controller registerUsers.php (under app/controller/registerUsers.php)

<?PHP


$this->load->model('register'),'', TRUE);


?>

I’m confused how I go about implementing this in a view from here?

  • 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-05-31T05:25:45+00:00Added an answer on May 31, 2026 at 5:25 am

    The MVC framework works as follows:

    Model interacts with the database:
    Here is where you want to put all of your functions that do nothing more than insert and return data to/from the database.

    Views are what the user sees:
    Here is where you’ll have your html pages that make use of the data you got through your model

    Controllers simply connect the two:
    The controller preps data, uses the model to interact with the database, and loads the views for the user to see

    If you had a function registerUser() in your register model, you would do something like this to actually use it within a function in the controller:

    $this->load->model( 'register' ); // Load register model
    $return = $this->register->registerUser( $_POST['username'], $_POST['email'], $_POST['password'] ); // Try to register the user to the database
    if( $return === "TRUE" ) {
      $this->load->view( 'success' ); // Hooray!
    }
    else {
      $this->load->view( 'fail' ); // :(
    }
    

    Here, the controller loads the register model, tries to save the username, email and password using the registerUser() function within the model, and loads the correct view accordingly.

    Obviously you’ll want to clean $_POST data and everything before writing it to the database. This should be done within the controller.

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

Sidebar

Related Questions

In User.class.php i have: $this->setCode(sha1($this->getPassword())); This is ok. In register form i would like
I have a register model thats tighly bound to a register view. The register
I have a model User . The model currently works with a Register view
I have model like this: scope :search_posts, lambda { |query| mega_posts.where( title LIKE ?
If I have Model.objects.all() I want to get only one object for any content_object=foo,
We're building a PHP app based on Good old codeigniter framework and have run
I have a model called Action. It looks like this: class Action < ActiveRecord::Base
I have this register system that doesn't work. Can you please help me!! Also
I have a model with field: class Movie(models.Model): genre = models.CommaSeparatedIntegerField(max_length=100, choices=GENRE_CHOICES, blank=True, default=0)
I'm having a FieldError . I have a model: class Foo(models.Model): __bar = models.TextField(default=lambda:

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.